Get rid of out of line memset(), as __builtin_memset() is not larger - even usually smaller - and faster anyway in all current and foreseeable occurrences.

This commit is contained in:
Lionel Debroux 2022-05-17 16:18:44 +02:00
parent dce2cfb079
commit 438201195d
2 changed files with 2 additions and 11 deletions

View File

@ -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;

View File

@ -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.