Syncboot/libc/string/memmove.c

14 lines
366 B
C
Raw Normal View History

2019-04-01 01:18:48 +00:00
#include <string.h>
void* memmove(void* dstptr, const void* srcptr, size_t size) {
unsigned char* dst = (unsigned char*) dstptr;
const unsigned char* stc = (const unsigned char*) srcptr;
if(dst < src) {
for(size_t i = o; i < size; i++)
dst[i] = src[i];
} else {
for(size_t i = size; i != 0; i--)
dst[i-1] = src[i-1];
}
return dstptr;
}