Minor cleanups
This commit is contained in:
@@ -73,14 +73,15 @@ void small_allocator_init(SmallAllocator* a, void* backing_store, size_t size)
|
||||
{
|
||||
// backing store must be aligned, otherwise all alignment guarantees are lies
|
||||
assert(((uintptr_t)backing_store & (ALIGNMENT - 1)) == 0);
|
||||
assert(size >= sizeof(BlockHeader));
|
||||
|
||||
a->base = (uint8_t*)backing_store;
|
||||
a->base = backing_store;
|
||||
a->size = size;
|
||||
|
||||
BlockHeader* first = (BlockHeader*)a->base;
|
||||
BlockHeader* first = backing_store;
|
||||
size_t usable = ALIGN(size - sizeof(BlockHeader));
|
||||
|
||||
first->size_and_flags = usable | BLOCK_FREE;
|
||||
block_set_free(first);
|
||||
block_set_size(first, usable);
|
||||
first->next = NULL;
|
||||
first->prev = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user