diff options
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 | } | ||
