BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 232d0f9e7dd31316a9b91cbdfec0174afce40c7e / lib / mem.c

// Related

Nucleus

Barry ACPI + APIC 232d0f9 (3 years, 3 months ago)
diff --git a/lib/mem.c b/lib/mem.c
index a41ec26..7cf1815 100644
--- a/lib/mem.c
+++ b/lib/mem.c
@@ -11,3 +11,26 @@ memset(void *dest, int byte, size_t len)
 	}
 	return dest;
 }
+
+/* Copy one region of memory to another */
+int
+memcmp(void *s1, void *s2, size_t n)
+{
+	unsigned char *a = (unsigned char *) s1,
+	              *b = (unsigned char *) s2;
+	while (n-- > 0)
+			if (*a++ != *b++)
+				return a[-1] - b[-1];
+	return 0;
+}
+
+/* Copy one region of memory to another */
+void *
+memcpy(void *dest, void *src, size_t n)
+{
+	unsigned char *a = (unsigned char *) dest,
+	              *b = (unsigned char *) src;
+	while (n-- > 0)
+		*a++ = *b++;
+	return dest;
+}