diff options
| author | EllipticEllipsis <elliptic.ellipsis@gmail.com> | 2022-05-01 23:06:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-02 00:06:35 +0200 |
| commit | e84f5ab3878b30bdddd2ee5a0dbddc10e00d219d (patch) | |
| tree | 67e1ac6584b3612b2b5e4066388ef2bc811efc1f /src/code/z_lib.c | |
| parent | 7334ffa373d7aeef31977c2fe39af711d7069809 (diff) | |
Memstuff (#1164)
* 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
Diffstat (limited to 'src/code/z_lib.c')
| -rw-r--r-- | src/code/z_lib.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 90df45b91..524d58a0a 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -1,10 +1,25 @@ #include "global.h" -void Lib_MemSet(u8* dest, size_t size, u8 val) { - u32 i; +/** + * memset: sets `len` bytes to `val` starting at address `dest`. + * + * Unlike normal memset, + * - `dest` is a `u8*` already, + * - does not return `dest`, + * - the arguments are in a different order, + * - `val` is a `u8` instead of the standard `s32`. + * + * @see There are two other memsets in this codebase, __osMemset(), MemSet() + * + * @param dest address to start at + * @param len number of bytes to write + * @param val value to write + */ +void Lib_MemSet(u8* dest, size_t len, u8 val) { + size_t i; // clang-format off - for (i = 0; i < size; i++) { *dest++ = val; } + for (i = 0; i < len; i++) { *dest++ = val; } // clang-format on } |
