| 38 | #undef memcmp |
| 39 | no_builtin("memcmp") |
| 40 | int memcmp(FAR const void *s1, FAR const void *s2, size_t n) |
| 41 | { |
| 42 | FAR unsigned char *p1 = (FAR unsigned char *)s1; |
| 43 | FAR unsigned char *p2 = (FAR unsigned char *)s2; |
| 44 | |
| 45 | while (n-- > 0) |
| 46 | { |
| 47 | if (*p1 < *p2) |
| 48 | { |
| 49 | return -1; |
| 50 | } |
| 51 | else if (*p1 > *p2) |
| 52 | { |
| 53 | return 1; |
| 54 | } |
| 55 | |
| 56 | p1++; |
| 57 | p2++; |
| 58 | } |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | #endif |