1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-28 18:01:32 +00:00
* 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
This commit is contained in:
EllipticEllipsis 2022-05-01 23:06:35 +01:00 committed by GitHub
parent 7334ffa373
commit e84f5ab387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 282 additions and 208 deletions

View file

@ -1,23 +1,47 @@
#include "global.h"
void* MemCopy(void* dest, void* src, s32 size) {
u8* destu = (u8*)dest;
u8* srcu = (u8*)src;
/**
* memcpy: copies `len` bytes from memory starting at `src` to memory starting at `dest`. Expects the memory
* specified by `src` and `dest` to not overlap.
*
* @see libultra also has a memcpy().
*
* @param dest address of start of buffer writing to
* @param src address of start of buffer to read from
* @param len number of bytes to copy. (`s32` rather than the standard `size_t`)
*
* @return dest
*/
void* MemCpy(void* dest, const void* src, s32 len) {
u8* d = dest;
const u8* s = src;
while (size > 0) {
*destu++ = *srcu++;
size--;
while (len > 0) {
*d++ = *s++;
len--;
}
return dest;
}
void* MemSet(void* dest, s32 val, s32 size) {
u8* destu = (u8*)dest;
s32 s = size;
/**
* memset: sets `len` bytes to `val` starting at address `dest`.
*
* @see There are two other memsets in this codebase, Lib_MemSet(), __osMemset().
* This one is unused.
*
* @param dest address to start at
* @param val value to write (`s32`, but interpreted as `u8`)
* @param len number of bytes to write. (`s32` rather than the standard `size_t`)
*
* @return dest
*/
void* MemSet(void* dest, s32 val, s32 len) {
u8* d = dest;
s32 s = len;
while (s > 0) {
*destu++ = val;
*d++ = val;
s--;
}