| 125 | */ |
| 126 | |
| 127 | int memcmp(const void *s1, const void *s2, size_t n) |
| 128 | { |
| 129 | size_t i = 0; |
| 130 | const unsigned long *w1 = s1, *w2 = s2; |
| 131 | |
| 132 | if (IS_ALIGNED((uintptr_t)s1, sizeof(unsigned long)) && |
| 133 | IS_ALIGNED((uintptr_t)s2, sizeof(unsigned long))) |
| 134 | for (; i < n / sizeof(unsigned long); i++) |
| 135 | if (w1[i] != w2[i]) |
| 136 | break; /* fall through to find differing byte */ |
| 137 | |
| 138 | for (i *= sizeof(unsigned long); i < n; i++) |
| 139 | if (((u8 *)s1)[i] != ((u8 *)s2)[i]) |
| 140 | return ((u8 *)s1)[i] - ((u8 *)s2)[i]; |
| 141 | |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | void *memchr(const void *s, int c, size_t n) |
| 146 | { |
no outgoing calls