mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Bug Fixes: some assertions; variable inits;
Remove some dead code
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user