mescc: Support binutils 2.25: memcmp: Support size 0.

* lib/libc+tcc.c (memcmp): Support size 0.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-17 10:18:59 +02:00
parent 0639e3faf1
commit c6ae0f41a3
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -335,11 +335,17 @@ memset (void *s, int c, size_t n)
} }
int int
memcmp (void const *s1, void const *s2, size_t n) memcmp (void const *s1, void const *s2, size_t size)
{ {
if (!size)
return 0;
char *a = s1; char *a = s1;
char *b = s2; char *b = s2;
while (*a == *b && --n) {a++;b++;} while (*a == *b && --size)
{
a++;
b++;
}
return *a - *b; return *a - *b;
} }