5 #define WS (sizeof(WT))
7 void *memmove(void *dest, const void *src, size_t n)
13 if (s+n <= d || d+n <= s) return memcpy(d, s, n);
16 if ((uintptr_t)s % WS == (uintptr_t)d % WS) {
17 while ((uintptr_t)d % WS) {
18 if (!n--) return dest;
21 for (; n>=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(WT *)s;
23 for (; n; n--) *d++ = *s++;
25 if ((uintptr_t)s % WS == (uintptr_t)d % WS) {
26 while ((uintptr_t)(d+n) % WS) {
27 if (!n--) return dest;
30 while (n>=WS) n-=WS, *(WT *)(d+n) = *(WT *)(s+n);
32 while (n) n--, d[n] = s[n];