Fix alignment issues with vectors, unions, and raw_unions

This commit is contained in:
Ginger Bill
2016-11-16 12:36:02 +00:00
parent 0cab083b8f
commit e2d98324ba
6 changed files with 133 additions and 50 deletions
+16
View File
@@ -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
}