meta: move photon/libc to root

This commit is contained in:
2026-02-08 20:45:25 +00:00
parent f00e74260d
commit 345a37962e
140 changed files with 0 additions and 0 deletions

27
libc/string/memmove.c Normal file
View File

@@ -0,0 +1,27 @@
#include <string.h>
#define ALIGNED(p) (!((long)p & (sizeof(long) - 1)))
#define QUADBLOCKSIZE (sizeof(long) << 2)
#define BLOCKSIZE (sizeof(long))
static void *memcpy_r(void *dest, const void *src, size_t sz)
{
unsigned char *d = dest;
const unsigned char *s = src;
for (size_t i = 0; i < sz; i++) {
size_t b = sz - i - 1;
d[b] = s[b];
}
return dest;
}
void *memmove(void *dest, const void *src, size_t n)
{
if (dest < src) {
return memcpy(dest, src, n);
} else {
return memcpy_r(dest, src, n);
}
}