5 typedef __attribute__((__may_alias__)) size_t WT;
6 #define WS (sizeof(WT))
9 void *memmove(void *dest, const void *src, size_t n)
15 if ((uintptr_t)s-(uintptr_t)d-n <= -2*n) return memcpy(d, s, n);
19 if ((uintptr_t)s % WS == (uintptr_t)d % WS) {
20 while ((uintptr_t)d % WS) {
21 if (!n--) return dest;
24 for (; n>=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(WT *)s;
27 for (; n; n--) *d++ = *s++;
30 if ((uintptr_t)s % WS == (uintptr_t)d % WS) {
31 while ((uintptr_t)(d+n) % WS) {
32 if (!n--) return dest;
35 while (n>=WS) n-=WS, *(WT *)(d+n) = *(WT *)(s+n);
38 while (n) n--, d[n] = s[n];