20 lines
428 B
C
20 lines
428 B
C
#include "klibc.h"
|
|
|
|
void *memcpy(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 *memset(void *src, int c, size_t n)
|
|
{
|
|
for (char *ptr = (char *)src; n > 0; n--, ptr++) {
|
|
*ptr = (char)c;
|
|
}
|
|
return src;
|
|
}
|