diff options
| author | nasr <nsrddyn@gmail.com> | 2026-10-05 22:02:56 +0200 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-10-05 22:02:56 +0200 |
| commit | f6d3090f7fa76eb8e0dbe060b8490cb49c001c39 (patch) | |
| tree | 433c773997e51f22738acb8b04c4fd2fc6b1bdc9 /source/base/base_memory.cpp | |
init: base
Diffstat (limited to 'source/base/base_memory.cpp')
| -rw-r--r-- | source/base/base_memory.cpp | 10 |
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 @@ | |||
| 1 | internal b32 is_pow(umm x) { return (x & (x - 1)) == 0; } | ||
| 2 | |||
| 3 | internal 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 | } | ||
