Skip to content

Commit 9b36e62

Browse files
committed
string: gate memmove fast path
1 parent ee9f21c commit 9b36e62

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/string.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,23 @@ void *memmove(void *dst, const void *src, size_t n)
295295
const char *s = (const char *)src;
296296
char *d = (char *)dst;
297297
size_t aligned_n = 0;
298+
#ifdef FAST_MEMCPY
298299
if (((size_t)dst & (sizeof(unsigned long)-1)) == 0 &&
299300
((size_t)src & (sizeof(unsigned long)-1)) == 0)
300301
{
301302
aligned_n = n & ~(sizeof(unsigned long) - 1);
302303
}
304+
#endif
303305
for (i = n; i > aligned_n; i--) {
304306
d[i - 1] = s[i - 1];
305307
}
308+
#ifdef FAST_MEMCPY
306309
while (aligned_n > 0) {
307310
aligned_n -= sizeof(unsigned long);
308311
*(unsigned long*)(d + aligned_n) =
309312
*(const unsigned long*)(s + aligned_n);
310313
}
314+
#endif
311315
return dst;
312316
} else {
313317
return memcpy(dst, src, n);

0 commit comments

Comments
 (0)