Switch array fill to flags

This commit is contained in:
2026-01-11 20:17:09 +00:00
parent ce76ac1e7c
commit a4492cf8e8
4 changed files with 26 additions and 19 deletions

View File

@@ -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;