From: Matthias Kruk Date: Fri, 1 May 2020 09:39:21 +0000 (+0900) Subject: libc: Add memset() function X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=40745f71e232af4fe89e78b42e858c608f05f1e0;p=corax libc: Add memset() function --- 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); +}