summaryrefslogtreecommitdiff
path: root/source/base/base.h
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-04-19 18:38:22 +0200
committernasr <nsrddyn@gmail.com>2026-04-19 18:38:22 +0200
commit36dc1f859a13e428c441fc8f4f35550fe12ed72f (patch)
treee8a98a43ccbd8b989427dc529dbdf37b2f942f9a /source/base/base.h
parent078e21a1feb811f9ef7797ce3ee5d2e8ffcccfce (diff)
feature(base): refactored the base library. removed some files etc and did stuff
Diffstat (limited to 'source/base/base.h')
-rwxr-xr-xsource/base/base.h26
1 files changed, 26 insertions, 0 deletions
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 @@
6#define global_variable static 6#define global_variable static
7#define local_persist static 7#define local_persist static
8 8
9#define ARENA_ALIGN (2 * sizeof(void *))
10
11#define MIN(a, b) (((a) < (b)) ? (a) : (b))
12#define MAX(a, b) (((a) > (b)) ? (a) : (b))
13
9#define unused(x) (void)(x) 14#define unused(x) (void)(x)
10#define NIL 0 15#define NIL 0
11 16
@@ -62,3 +67,24 @@ typedef intptr_t smm;
62#define Len(s) (sizeof(s) - 1) 67#define Len(s) (sizeof(s) - 1)
63 68
64#endif 69#endif
70
71#ifdef BASE_IMPLEMENTATION
72
73internal inline b8
74is_pow(umm x)
75{
76 return (x & (x - 1)) == 0;
77}
78
79internal inline u64
80align(u64 pointer, umm alignment)
81{
82 if ((alignment & (alignment - 1)) == 0)
83 {
84 return pointer;
85 }
86
87 return (pointer + alignment - 1) & ~(alignment - 1);
88}
89
90#endif