summaryrefslogtreecommitdiff
path: root/source/base/base_memory.cpp
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-10-05 22:02:56 +0200
committernasr <nsrddyn@gmail.com>2026-10-05 22:02:56 +0200
commitf6d3090f7fa76eb8e0dbe060b8490cb49c001c39 (patch)
tree433c773997e51f22738acb8b04c4fd2fc6b1bdc9 /source/base/base_memory.cpp
init: base
Diffstat (limited to 'source/base/base_memory.cpp')
-rw-r--r--source/base/base_memory.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/base/base_memory.cpp b/source/base/base_memory.cpp
new file mode 100644
index 0000000..e99c174
--- /dev/null
+++ b/source/base/base_memory.cpp
@@ -0,0 +1,10 @@
1internal b32 is_pow(umm x) { return (x & (x - 1)) == 0; }
2
3internal u64 align(u64 pointer, umm alignment)
4{
5 if ((alignment & (alignment - 1)) != 0) {
6 return pointer;
7 }
8
9 return (pointer + alignment - 1) & ~(alignment - 1);
10}