diff options
Diffstat (limited to 'src/init/stdlib.c')
-rw-r--r-- | src/init/stdlib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/init/stdlib.c b/src/init/stdlib.c new file mode 100644 index 0000000..6ed5a0a --- /dev/null +++ b/src/init/stdlib.c @@ -0,0 +1,12 @@ +#include <init/stdlib.h> + +int memcmp(const void *s1, const void *s2, size_t n) { + const unsigned char *c1 = s1, *c2 = s2; + for (size_t i = 0; i < n; i++) { + if (c1[i] != c2[i]) { + if (c1[i] < c2[i]) return -1; + else return 1; + } + } + return 0; +} |