mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-02 07:46:01 +00:00
e84f5ab387
* Un-fake a couple of matches in memory manip functions * Document fmodf * Un-fake a couple of matches in memory manip functions * Document fmodf * Rename functions and files * Document memmove, memsets, memcpys * Format * Sort out some missing sizeofs * Name fmodf * Rename local variables * size_t * Use COBRA_SHADOW_TEX_SIZE * Review * Tweak the Doxyfile to remove @brief requirement * Roman's review * Fix a bug comment * Change fmodf
33 lines
712 B
C
33 lines
712 B
C
#include "global.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* __osMemmove(void* dest, const void* src, size_t len) {
|
|
u8* d = dest;
|
|
const u8* 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;
|
|
}
|