Use assert in wapp_mem_util_align_forward instead of returning NULL

This commit is contained in:
Abdelrahman Said 2025-05-05 18:51:10 +01:00
parent aae39fe656
commit 3fed536a74
2 changed files with 2 additions and 6 deletions

View File

@ -7,11 +7,8 @@
internal bool is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
void *wapp_mem_util_align_forward(void *ptr, u64 alignment) {
if (!ptr) {
return NULL;
}
assert(is_power_of_two(alignment));
assert(ptr != NULL && "ptr argument shouldn't be NULL");
assert(is_power_of_two(alignment) && "Alignment isn't a power of 2");
uptr p = (uptr)ptr;
uptr align = (uptr)alignment;

View File

@ -14,7 +14,6 @@
#error "Unrecognised platform"
#endif
void *wapp_mem_util_align_forward(void *ptr, u64 alignment);
void *wapp_mem_util_alloc(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type);
void wapp_mem_util_free(void *ptr, u64 size);