k-tana-zero/libs/libc/memmove.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

17 lines
256 B
C

#include <stddef.h>
#include <string.h>
void *memmove(void *dest, const void *src, size_t n)
{
char *d = dest;
const char *s = src;
if (s < d && s + n > d) {
while (n-- > 0)
d[n - 1] = s[n - 1];
return dest;
}
return memcpy(dest, src, n);
}