mirror of
https://github.com/zeldaret/oot
synced 2026-06-10 04:54:03 -04:00
cbf9eacf42
* [headers 12] add kaleido_manager.h, move various protos to headers * BSS * bss
34 lines
712 B
C
34 lines
712 B
C
#include "string.h"
|
|
|
|
/**
|
|
* memmove: copies `len` bytes from memory starting at `src` to memory starting at `dest`.
|
|
*
|
|
* Unlike memcpy(), the regions of memory may overlap.
|
|
*
|
|
* @param dest address of start of buffer to write to
|
|
* @param src address of start of buffer to read from
|
|
* @param len number of bytes to copy.
|
|
*
|
|
* @return dest
|
|
*/
|
|
void* memmove(void* dest, const void* src, size_t len) {
|
|
char* d = dest;
|
|
const char* s = src;
|
|
|
|
if (d == s) {
|
|
return dest;
|
|
}
|
|
if (d < s) {
|
|
while (len--) {
|
|
*d++ = *s++;
|
|
}
|
|
} else {
|
|
d += len - 1;
|
|
s += len - 1;
|
|
while (len--) {
|
|
*d-- = *s--;
|
|
}
|
|
}
|
|
return dest;
|
|
}
|