smol-gilbraltar/nolibc/memcmp.c

9 lines
175 B
C
Raw Permalink Normal View History

2024-12-20 22:45:12 +00:00
#include <string.h>
int memcmp(const void *vl, const void *vr, size_t n)
{
const unsigned char *l=vl, *r=vr;
for (; n && *l == *r; n--, l++, r++);
return n ? *l-*r : 0;
}