mescc: Support binutils 2.25: memcmp: Support size 0.
* lib/libc+tcc.c (memcmp): Support size 0.
This commit is contained in:
parent
0639e3faf1
commit
c6ae0f41a3
|
@ -335,11 +335,17 @@ memset (void *s, int c, size_t n)
|
|||
}
|
||||
|
||||
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 *b = s2;
|
||||
while (*a == *b && --n) {a++;b++;}
|
||||
while (*a == *b && --size)
|
||||
{
|
||||
a++;
|
||||
b++;
|
||||
}
|
||||
return *a - *b;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue