Add cmd.cpp cmd.h, MA_LENGTHOF to MA_Lengthof

This commit is contained in:
Krzosa Karol
2024-03-04 15:26:15 +01:00
parent 2abd8870cb
commit 3f358584bb
7 changed files with 228 additions and 30 deletions

View File

@@ -348,7 +348,7 @@ MA_THREAD_LOCAL MA_Arena MA_ScratchArenaPool[4];
MA_API MA_Checkpoint MA_GetScratchEx(MA_Arena **conflicts, int conflict_count) {
MA_Arena *unoccupied = 0;
for (int i = 0; i < MA_LENGTHOF(MA_ScratchArenaPool); i += 1) {
for (int i = 0; i < MA_Lengthof(MA_ScratchArenaPool); i += 1) {
MA_Arena *from_pool = MA_ScratchArenaPool + i;
unoccupied = from_pool;
for (int conflict_i = 0; conflict_i < conflict_count; conflict_i += 1) {

View File

@@ -129,7 +129,7 @@ MA_API void MA_SaveSourceLocEx(const char *file, int line);
#define MA_IS_POW2(x) (((x) & ((x)-1)) == 0)
#define MA_MIN(x, y) ((x) <= (y) ? (x) : (y))
#define MA_MAX(x, y) ((x) >= (y) ? (x) : (y))
#define MA_LENGTHOF(x) ((int64_t)((sizeof(x) / sizeof((x)[0]))))
#define MA_Lengthof(x) ((int64_t)((sizeof(x) / sizeof((x)[0]))))
#define MA_CLAMP_TOP(x, max) ((x) >= (max) ? (max) : (x))
#define MA_CLAMP_BOT(x, min) ((x) <= (min) ? (min) : (x))