summaryrefslogtreecommitdiff
path: root/src/kernel/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/util.c')
-rw-r--r--src/kernel/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kernel/util.c b/src/kernel/util.c
index f4dc5e1..0977745 100644
--- a/src/kernel/util.c
+++ b/src/kernel/util.c
@@ -15,3 +15,14 @@ void *memset(void *s, int c, size_t n) {
s2[i] = c;
return s;
}
+
+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;
+}