1#define SYSCLIB_DISABLE_BUILTINS
5void *memcpy(
void *restrict dest,
const void *restrict src,
size_t n)
7 unsigned char *d = dest;
8 const unsigned char *s = src;
12#if __BYTE_ORDER == __LITTLE_ENDIAN
24 for (; (uintptr_t)s % 4 && n; n--) *d++ = *s++;
26 if ((uintptr_t)d % 4 == 0) {
27 for (; n>=16; s+=16, d+=16, n-=16) {
28 *(u32 *)(d+0) = *(u32 *)(s+0);
29 *(u32 *)(d+4) = *(u32 *)(s+4);
30 *(u32 *)(d+8) = *(u32 *)(s+8);
31 *(u32 *)(d+12) = *(u32 *)(s+12);
34 *(u32 *)(d+0) = *(u32 *)(s+0);
35 *(u32 *)(d+4) = *(u32 *)(s+4);
39 *(u32 *)(d+0) = *(u32 *)(s+0);
43 *d++ = *s++; *d++ = *s++;
51 if (n >= 32)
switch ((uintptr_t)d % 4) {
58 for (; n>=17; s+=16, d+=16, n-=16) {
60 *(u32 *)(d+0) = (w LS 24) | (x RS 8);
62 *(u32 *)(d+4) = (x LS 24) | (w RS 8);
64 *(u32 *)(d+8) = (w LS 24) | (x RS 8);
66 *(u32 *)(d+12) = (x LS 24) | (w RS 8);
74 for (; n>=18; s+=16, d+=16, n-=16) {
76 *(u32 *)(d+0) = (w LS 16) | (x RS 16);
78 *(u32 *)(d+4) = (x LS 16) | (w RS 16);
80 *(u32 *)(d+8) = (w LS 16) | (x RS 16);
82 *(u32 *)(d+12) = (x LS 16) | (w RS 16);
89 for (; n>=19; s+=16, d+=16, n-=16) {
91 *(u32 *)(d+0) = (w LS 8) | (x RS 24);
93 *(u32 *)(d+4) = (x LS 8) | (w RS 24);
95 *(u32 *)(d+8) = (w LS 8) | (x RS 24);
97 *(u32 *)(d+12) = (x LS 8) | (w RS 24);
102 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
103 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
104 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
105 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
108 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
109 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
112 *d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
115 *d++ = *s++; *d++ = *s++;
123 for (; n; n--) *d++ = *s++;