Add memmove to klibc

This commit is contained in:
Mathieu Maret 2023-03-05 20:34:24 +01:00
parent a65a3d1697
commit 098330c845
2 changed files with 18 additions and 0 deletions

View File

@ -30,6 +30,16 @@ int memcmp(const void *aptr, const void *bptr, size_t size)
/* Threshhold for punting to the byte copier. */ /* Threshhold for punting to the byte copier. */
#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE)
void *memmove(void *dst, const void *src, size_t n)
{
char *dstChar = dst;
const char *srcChar = src;
for (size_t i = 0; i < n; i++) {
*(dstChar++) = *(srcChar++);
}
return dst;
}
void *memcpy(void *dst0, const void *src0, size_t len0) void *memcpy(void *dst0, const void *src0, size_t len0)
{ {
#if 0 #if 0

View File

@ -11,7 +11,15 @@
((c) == '\v')) ((c) == '\v'))
#define isprint(c) ((' ' <= (c)) && ((c) <= '~')) #define isprint(c) ((' ' <= (c)) && ((c) <= '~'))
/** compares the first @param n bytes (each interpreted as
* unsigned char) of the memory areas @param s1 and @param s2.
*/
int memcmp(const void *s1, const void *s2, size_t n); int memcmp(const void *s1, const void *s2, size_t n);
/**
* copies n bytes from memory area src to memory area dest. The memory areas may overlap
*/
void *memmove(void *dest, const void *src, size_t n);
void *memcpy(void *dest, const void *src, size_t n); void *memcpy(void *dest, const void *src, size_t n);
void *memset(void *s, int c, size_t n); void *memset(void *s, int c, size_t n);
char *itoa(long long int value, char *str, int base); char *itoa(long long int value, char *str, int base);