#include #include void* memcpy(void* dest, const void* src, size_t len) { if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { const uintptr_t* s = src; uintptr_t *d = dest; while (d < (uintptr_t*)(dest + len)) *d++ = *s++; } else { const char* s = src; char *d = dest; while (d < (char*)(dest + len)) *d++ = *s++; } return dest; } void* memset(void* dest, int byte, size_t len) { if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { uintptr_t word = byte & 0xFF; word |= word << 8; word |= word << 16; word |= word << 16 << 16; uintptr_t *d = dest; while (d < (uintptr_t*)(dest + len)) *d++ = word; } else { char *d = dest; while (d < (char*)(dest + len)) *d++ = byte; } return dest; } size_t strlen(const char *s) { const char *p = s; while (*p) p++; return p - s; } char* strcpy(char* dest, const char* src) { char* d = dest; while ((*d++ = *src++)) ; return dest; }