From 36dc1f859a13e428c441fc8f4f35550fe12ed72f Mon Sep 17 00:00:00 2001 From: nasr Date: Sun, 19 Apr 2026 18:38:22 +0200 Subject: feature(base): refactored the base library. removed some files etc and did stuff --- source/base/base.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source/base/base.h') diff --git a/source/base/base.h b/source/base/base.h index 3fe9dca..f908962 100755 --- a/source/base/base.h +++ b/source/base/base.h @@ -6,6 +6,11 @@ #define global_variable static #define local_persist static +#define ARENA_ALIGN (2 * sizeof(void *)) + +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + #define unused(x) (void)(x) #define NIL 0 @@ -62,3 +67,24 @@ typedef intptr_t smm; #define Len(s) (sizeof(s) - 1) #endif + +#ifdef BASE_IMPLEMENTATION + +internal inline b8 +is_pow(umm x) +{ + return (x & (x - 1)) == 0; +} + +internal inline u64 +align(u64 pointer, umm alignment) +{ + if ((alignment & (alignment - 1)) == 0) + { + return pointer; + } + + return (pointer + alignment - 1) & ~(alignment - 1); +} + +#endif -- cgit v1.3