Bug Fixes: some assertions; variable inits;

Remove some dead code
This commit is contained in:
Ginger Bill
2016-09-24 22:55:17 +01:00
parent ff229054a1
commit 70f3361a34
11 changed files with 103 additions and 140 deletions
+18
View File
@@ -27,6 +27,24 @@ align_forward :: proc(ptr: rawptr, align: int) -> rawptr {
}
AllocationHeader :: struct {
size: int
}
allocation_header_fill :: proc(header: ^AllocationHeader, data: rawptr, size: int) {
header.size = size
ptr := ptr_offset(header, 1) as ^int
for i := 0; ptr as rawptr < data; i++ {
ptr_offset(ptr, i)^ = -1
}
}
allocation_header :: proc(data: rawptr) -> ^AllocationHeader {
p := data as ^int
for ptr_offset(p, -1)^ == -1 {
p = ptr_offset(p, -1)
}
return ptr_offset(p as ^AllocationHeader, -1)
}