aboutsummaryrefslogtreecommitdiff
path: root/libc/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/mem.c')
-rw-r--r--libc/mem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/mem.c b/libc/mem.c
index 2fde00b..c81a13f 100644
--- a/libc/mem.c
+++ b/libc/mem.c
@@ -43,6 +43,18 @@ void *memset(void *dest, int val, u32 n)
return dest;
}
+void *memchr(void *src, int c, u32 n)
+{
+ const u8 *s = (const u8 *)src;
+
+ while (n-- > 0) {
+ if (*s == c)
+ return (void *)s;
+ s++;
+ }
+ return NULL;
+}
+
int memcmp(const void *s1, const void *s2, u32 n)
{
const u8 *a = (const u8 *)s1;