summaryrefslogtreecommitdiff
path: root/source/base/base_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/base/base_mem.c')
-rw-r--r--source/base/base_mem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/base/base_mem.c b/source/base/base_mem.c
new file mode 100644
index 0000000..f20ba39
--- /dev/null
+++ b/source/base/base_mem.c
@@ -0,0 +1,17 @@
1internal inline b8
2is_pow(umm x)
3{
4 return (x & (x - 1)) == 0;
5}
6
7internal inline u64
8align(u64 pointer, umm alignment)
9{
10 if ((alignment & (alignment - 1)) == 0)
11 {
12 return pointer;
13 }
14
15 return (pointer + alignment - 1) & ~(alignment - 1);
16}
17