aboutsummaryrefslogtreecommitdiff
path: root/src/common_memory.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-14 12:58:45 +0000
committergingerBill <bill@gingerbill.org>2023-01-14 12:58:45 +0000
commit868aa4c14ab6c63b9b797f4a8178c73b69897711 (patch)
tree311c9f807830cb32f7102c49b22053da7087a883 /src/common_memory.cpp
parent1ab90de4931f07ea61b1195de602f282a853568b (diff)
Minor changes to `StringMap` allocation
Diffstat (limited to 'src/common_memory.cpp')
-rw-r--r--src/common_memory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common_memory.cpp b/src/common_memory.cpp
index 22b91d8cb..e07276aa1 100644
--- a/src/common_memory.cpp
+++ b/src/common_memory.cpp
@@ -509,7 +509,7 @@ gb_internal GB_ALLOCATOR_PROC(heap_allocator_proc) {
template <typename T>
-gb_internal isize resize_array_raw(T **array, gbAllocator const &a, isize old_count, isize new_count) {
+gb_internal isize resize_array_raw(T **array, gbAllocator const &a, isize old_count, isize new_count, isize custom_alignment=1) {
GB_ASSERT(new_count >= 0);
if (new_count == 0) {
gb_free(a, *array);
@@ -521,7 +521,7 @@ gb_internal isize resize_array_raw(T **array, gbAllocator const &a, isize old_co
}
isize old_size = old_count * gb_size_of(T);
isize new_size = new_count * gb_size_of(T);
- isize alignment = gb_align_of(T);
+ isize alignment = gb_max(gb_align_of(T), custom_alignment);
auto new_data = cast(T *)gb_resize_align(a, *array, old_size, new_size, alignment);
GB_ASSERT(new_data != nullptr);
*array = new_data;