k-tana-zero/libs/libc/memcmp.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

14 lines
214 B
C

#include <string.h>
int memcmp(const void *s1, const void *s2, size_t n)
{
const char *d1 = s1;
const char *d2 = s2;
for (size_t i = 0; i < n; ++i)
if (d1[i] != d2[i])
return d1[i] - d2[i];
return 0;
}