Switch array fill to flags
This commit is contained in:
@@ -204,7 +204,8 @@ u64 _array_alloc_size(u64 capacity, u64 item_size) {
|
||||
return sizeof(ArrayHeader) + item_size * capacity;
|
||||
}
|
||||
|
||||
GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, u64 item_size, b8 fill) {
|
||||
GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, u64 item_size,
|
||||
ArrayInitFlags flags) {
|
||||
wapp_runtime_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
|
||||
GenericArray output = NULL;
|
||||
@@ -217,7 +218,7 @@ GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, u64
|
||||
|
||||
output = (u8 *)(header + 1);
|
||||
header->magic = WAPP_ARRAY_MAGIC;
|
||||
header->count = fill ? capacity : 0;
|
||||
header->count = flags & ARRAY_INIT_FILLED ? capacity : 0;
|
||||
header->capacity = capacity;
|
||||
header->item_size = item_size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user