Changed as suggested by Frans Meulenbroeks

This commit is contained in:
ceriel 1993-11-23 15:35:08 +00:00
parent 0e6e7bc913
commit 12bc7ed391

View file

@ -9,13 +9,13 @@
int int
memcmp(const void *s1, const void *s2, size_t n) memcmp(const void *s1, const void *s2, size_t n)
{ {
register const char *p1 = s1, *p2 = s2; register const unsigned char *p1 = s1, *p2 = s2;
if (n) { if (n) {
n++; n++;
while (--n > 0) { while (--n > 0) {
if (*p1++ == *p2++) continue; if (*p1++ == *p2++) continue;
return (unsigned char) *--p1 - (unsigned char) *--p2; return *--p1 - *--p2;
} }
} }
return 0; return 0;