summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-29 14:47:39 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-29 14:47:39 +0800
commit61c80f9a54ba499b5897a43990b46cf9a67e60c0 (patch)
treed5f3fc67485f6ac5204b3fa20afefc06ae715bfb
parentd73b9944848e8cd544564ecb0dd0ec96710237bb (diff)
downloadrich4-61c80f9a54ba499b5897a43990b46cf9a67e60c0.tar.xz
it's not memmove
-rw-r--r--csrc/mkf_decompress.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/csrc/mkf_decompress.c b/csrc/mkf_decompress.c
index ea9ac4f..ba0df17 100644
--- a/csrc/mkf_decompress.c
+++ b/csrc/mkf_decompress.c
@@ -662,27 +662,18 @@ void mkf_decompress(void *arg1, void *arg2)
ecx = old_ecx + eax;
if (dx == 0xfff)
return;
- old_ecx = ecx;
+
bx -= 0xfd;
void *old_esi = esi;
esi = edi - 1 - dx;
- /* the following is a little bit tricky,
- * if we use memcpy/memmove, the picture is broken
- */
-#if 1
- ecx = bx;
- do {
+ /* note that it's not memcpy/memmove!! */
+ for (size_t i = 0; i < bx; i++) {
*(uint8_t*)edi = *(uint8_t*)esi;
edi++;
esi++;
- ecx--;
- } while (ecx);
-#else
- memmove(edi, esi, bx); /* using rep movsb */
- edi += bx; /* by movsb */
-#endif
+ }
+
esi = old_esi;
- ecx = old_ecx;
}
}