diff --git a/lib/string.c b/lib/string.c index 89f0f8d..4781312 100644 --- a/lib/string.c +++ b/lib/string.c @@ -74,16 +74,6 @@ void *memmove(void *dest, const void *src, size_t n) return dest; } -void *memset(void *s, int c, size_t n) -{ - char *d = (char *)s; - - for (size_t i = 0; i < n; i++) { - d[i] = c; - } - return s; -} - size_t strlen(const char *s) { size_t len = 0; diff --git a/lib/string.h b/lib/string.h index 37bd392..b6e877a 100644 --- a/lib/string.h +++ b/lib/string.h @@ -37,8 +37,9 @@ void *memmove(void *dest, const void *src, size_t n); /** * Fills the first n bytes of the memory area pointed to by s with the byte * value c. + * void *memset(void *s, int c, size_t n); */ -void *memset(void *s, int c, size_t n); +#define memset(s, c, n) __builtin_memset((s), (c), (n)) /** * Returns the string length, excluding the terminating null character.