From 40745f71e232af4fe89e78b42e858c608f05f1e0 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Fri, 1 May 2020 18:39:21 +0900 Subject: [PATCH] libc: Add memset() function --- libc/string.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libc/string.c b/libc/string.c index 5ae3b1d..af6ea7f 100644 --- a/libc/string.c +++ b/libc/string.c @@ -8,3 +8,16 @@ size_t strlen(const char *s) return(ret_val); } + +void *memset(void *s, int c, size_t n) +{ + char *ptr; + + ptr = (char*)s; + + while(--n >= 0) { + *ptr++ = (char)c; + } + + return(s); +} -- 2.47.3