diff options
| author | nasr <nsrddyn@gmail.com> | 2026-04-16 17:10:02 +0200 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-04-16 17:10:02 +0200 |
| commit | 8ea6a3c8621287d11296b8300029f32a27743d9a (patch) | |
| tree | cd12aa5fcd3e058fa74b45705c7b82524658d444 /source/base/base_mem.h | |
| parent | f430bfe8f71430032bec689bf0bbdc94ac409c22 (diff) | |
feature(checkpoint): checkpoint cleaning up base library
Diffstat (limited to 'source/base/base_mem.h')
| -rw-r--r-- | source/base/base_mem.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/base/base_mem.h b/source/base/base_mem.h index 945f0ce..2778fce 100644 --- a/source/base/base_mem.h +++ b/source/base/base_mem.h | |||
| @@ -5,4 +5,22 @@ | |||
| 5 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | 5 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| 6 | #define MAX(a, b) (((a) > (b)) ? (a) : (b)) | 6 | #define MAX(a, b) (((a) > (b)) ? (a) : (b)) |
| 7 | 7 | ||
| 8 | internal inline b8 | ||
| 9 | is_pow(umm x) | ||
| 10 | { | ||
| 11 | return (x & (x - 1)) == 0; | ||
| 12 | } | ||
| 13 | |||
| 14 | internal inline u64 | ||
| 15 | align(u64 pointer, umm alignment) | ||
| 16 | { | ||
| 17 | if ((alignment & (alignment - 1)) == 0) | ||
| 18 | { | ||
| 19 | return pointer; | ||
| 20 | } | ||
| 21 | |||
| 22 | return (pointer + alignment - 1) & ~(alignment - 1); | ||
| 23 | } | ||
| 24 | |||
| 25 | |||
| 8 | #endif | 26 | #endif |
