Use assert in wapp_mem_util_align_forward instead of returning NULL
This commit is contained in:
parent
aae39fe656
commit
3fed536a74
@ -7,11 +7,8 @@
|
|||||||
internal bool is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
|
internal bool is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
|
||||||
|
|
||||||
void *wapp_mem_util_align_forward(void *ptr, u64 alignment) {
|
void *wapp_mem_util_align_forward(void *ptr, u64 alignment) {
|
||||||
if (!ptr) {
|
assert(ptr != NULL && "ptr argument shouldn't be NULL");
|
||||||
return NULL;
|
assert(is_power_of_two(alignment) && "Alignment isn't a power of 2");
|
||||||
}
|
|
||||||
|
|
||||||
assert(is_power_of_two(alignment));
|
|
||||||
|
|
||||||
uptr p = (uptr)ptr;
|
uptr p = (uptr)ptr;
|
||||||
uptr align = (uptr)alignment;
|
uptr align = (uptr)alignment;
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#error "Unrecognised platform"
|
#error "Unrecognised platform"
|
||||||
#endif
|
#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_alloc(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type);
|
||||||
void wapp_mem_util_free(void *ptr, u64 size);
|
void wapp_mem_util_free(void *ptr, u64 size);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user