diff options
author | Vladimir Menshakov | 2011-06-16 00:20:30 +0400 |
---|---|---|
committer | Vladimir Menshakov | 2011-06-16 00:20:30 +0400 |
commit | e0efde7cf65e0f22d5afa830339fb1dc6ca91479 (patch) | |
tree | 05dcc4ec22131e7175d2bef18a5e0294c18dd7fe /engines/dreamweb/runtime.h | |
parent | c1b9adb69122d86665079c619a535095d7fe1507 (diff) | |
download | scummvm-rg350-e0efde7cf65e0f22d5afa830339fb1dc6ca91479.tar.gz scummvm-rg350-e0efde7cf65e0f22d5afa830339fb1dc6ca91479.tar.bz2 scummvm-rg350-e0efde7cf65e0f22d5afa830339fb1dc6ca91479.zip |
DREAMWEB: optimized consequtive movsb/w and stosb/w
Diffstat (limited to 'engines/dreamweb/runtime.h')
-rw-r--r-- | engines/dreamweb/runtime.h | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 1fb232c187..3b97ce1930 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -449,31 +449,58 @@ public: src = r; } + inline void _lodsb() { + al = ds.byte(si++); + } + + inline void _lodsw() { + ax = ds.word(si); + si += 2; + } + inline void _movsb() { es.byte(di++) = ds.byte(si++); } + inline void _movsb(uint size) { + uint8 *dst = es.ptr(di, size); + uint8 *src = ds.ptr(si, size); + memcpy(dst, src, size); + di += size; + si += size; + } + inline void _movsw() { _movsb(); _movsb(); } - inline void _lodsb() { - al = ds.byte(si++); - } - - inline void _lodsw() { - ax = ds.word(si); - si += 2; + inline void _movsw(uint size) { + _movsb(size * 2); } inline void _stosb() { es.byte(di++) = al; } + inline void _stosb(uint size) { + uint8 *dst = es.ptr(di, size); + memset(dst, al, size); + di += size; + } + inline void _stosw() { - es.word(di) = ax; - di += 2; + es.byte(di++) = al; + es.byte(di++) = ah; + } + + inline void _stosw(uint size) { + uint8 *dst = es.ptr(di, size); + di += 2 * size; + while(size--) { + *dst++ = al; + *dst++ = ah; + } } inline void _xchg(uint16 &a, uint16 &b) { |