28 lines
521 B
C
28 lines
521 B
C
#include "memory.h"
|
|
|
|
#if !CRTLIB
|
|
|
|
__attribute((section(".text.memcpy")))
|
|
void *memcpy(void *restrict dest, const void *restrict src, u64 n)
|
|
{
|
|
__prof;
|
|
/* TODO: Faster memcpy */
|
|
for (u64 i = 0; i < n; ++i) {
|
|
((u8 *)dest)[i] = ((u8 *)src)[i];
|
|
}
|
|
return dest;
|
|
}
|
|
|
|
__attribute((section(".text.memset")))
|
|
void *memset(void *dest, int c, u64 n)
|
|
{
|
|
__prof;
|
|
/* TODO: Faster memset */
|
|
for (u64 i = 0; i < (n); ++i) {
|
|
((u8 *)dest)[i] = c;
|
|
}
|
|
return dest;
|
|
}
|
|
|
|
#endif /* !CRTLIB */
|