Get rid of memcpy(), as __builtin_memcpy() is globally smaller - and faster anyway - in all current and foreseeable occurrences.

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

View File

@ -43,16 +43,6 @@ int memcmp(const void *s1, const void *s2, size_t n)
return 0;
}
void *memcpy(void *dest, const void *src, size_t n)
{
char *d = (char *)dest, *s = (char *)src;
for (size_t i = 0; i < n; i++) {
d[i] = s[i];
}
return dest;
}
void *memmove(void *dest, const void *src, size_t n)
{
char *d = (char *)dest, *s = (char *)src;

View File

@ -24,8 +24,9 @@ int memcmp(const void *s1, const void *s2, size_t n);
* Copies n bytes from the memory area pointed to by src to the memory area
* pointed to by dest and returns a pointer to dest. The memory areas must
* not overlap.
* void *memcpy(void *dst, const void *src, size_t n);
*/
void *memcpy(void *dst, const void *src, size_t n);
#define memcpy(d, s, n) __builtin_memcpy((d), (s), (n))
/**
* Copies n bytes from the memory area pointed to by src to the memory area