Change memory layout of map to be 3 words smaller

This commit is contained in:
gingerBill
2018-08-30 19:14:10 +01:00
parent e0240c186f
commit aa542980ce
12 changed files with 114 additions and 44 deletions
+3
View File
@@ -39,9 +39,12 @@ free_all :: inline proc(allocator := context.allocator, loc := #caller_location)
}
resize :: inline proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAULT_ALIGNMENT, allocator := context.allocator, loc := #caller_location) -> rawptr {
assert(allocator.procedure != nil);
if new_size == 0 {
free(ptr, allocator, loc);
return nil;
} else if ptr == nil {
return allocator.procedure(allocator.data, Allocator_Mode.Alloc, new_size, alignment, nil, 0, 0, loc);
}
return allocator.procedure(allocator.data, Allocator_Mode.Resize, new_size, alignment, ptr, old_size, 0, loc);
}
+1 -1
View File
@@ -27,7 +27,7 @@ Raw_Dynamic_Array :: struct {
}
Raw_Map :: struct {
hashes: [dynamic]int,
hashes: []int,
entries: Raw_Dynamic_Array,
}