diff options
| author | nasr <nsrddyn@gmail.com> | 2026-03-02 22:43:16 +0000 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-03-02 22:43:16 +0000 |
| commit | 56ebfa3f4b0d7a80090b344b294252d2be152bb0 (patch) | |
| tree | 9d12900a2870dde05e7ce6581104dc2b3070dbe1 /source/base/base_mem.c | |
| parent | 9053e4a0a20f0c0338aa4c5d9f9c0520184bcad7 (diff) | |
feature(main): base library impelmentation
Diffstat (limited to 'source/base/base_mem.c')
| -rw-r--r-- | source/base/base_mem.c | 17 |
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 @@ | |||
| 1 | internal inline b8 | ||
| 2 | is_pow(umm x) | ||
| 3 | { | ||
| 4 | return (x & (x - 1)) == 0; | ||
| 5 | } | ||
| 6 | |||
| 7 | internal inline u64 | ||
| 8 | align(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 | |||
