Fix 8 byte alignment in temp allocator; close #68

This commit is contained in:
Dominic Szablewski 2023-09-04 13:58:43 +02:00
parent ecf1e63508
commit 701e2d55e6

View file

@ -46,7 +46,7 @@ void mem_reset(void *p) {
// and aftewards free A then B.
void *mem_temp_alloc(uint32_t size) {
size = ((size >> 3) + 7) << 3; // allign to 8 bytes
size = ((size + 7) >> 3) << 3; // allign to 8 bytes
error_if(bump_len + temp_len + size >= MEM_HUNK_BYTES, "Failed to allocate %d bytes in temp mem", size);
error_if(temp_objects_len >= MEM_TEMP_OBJECTS_MAX, "MEM_TEMP_OBJECTS_MAX reached");