Fix alignment issues with vectors, unions, and raw_unions
This commit is contained in:
1 parent
0cab083b8f
commit
e2d98324ba
6 files changed
+133
-50
No files matched your search
@@ -233,6 +233,7 @@ default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator.Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, flags: u64) -> rawptr {
|
||||
using Allocator.Mode
|
||||
/*
|
||||
match mode {
|
||||
case ALLOC:
|
||||
total_size := size + alignment + size_of(mem.AllocationHeader)
|
||||
@@ -257,6 +258,21 @@ default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator.Mode,
|
||||
mem.allocation_header_fill(header, ptr, size)
|
||||
return mem.zero(ptr, size)
|
||||
}
|
||||
*/
|
||||
match mode {
|
||||
case ALLOC:
|
||||
return os.heap_alloc(size)
|
||||
|
||||
case FREE:
|
||||
os.heap_free(old_memory)
|
||||
return nil
|
||||
|
||||
case FREE_ALL:
|
||||
// NOTE(bill): Does nothing
|
||||
|
||||
case RESIZE:
|
||||
return os.heap_resize(old_memory, size)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user