Add file listing
This commit is contained in:
@@ -3,7 +3,6 @@ SizeU :: U64
|
||||
arena_di: U64
|
||||
|
||||
Arena :: struct
|
||||
// allocator: Allocator
|
||||
di: U64 // @debug_id
|
||||
memory: Os.Memory
|
||||
alignment: U64
|
||||
@@ -48,32 +47,19 @@ arena_push_size :: (a: *Arena, size: SizeU): *void
|
||||
a.len += size
|
||||
return result
|
||||
|
||||
// @todo: Make this compile time thing!!!
|
||||
// This probably will wait till polymorphism stuff
|
||||
// something like this:
|
||||
// arena_push_type :: (a: *Arena, type: $T): *T
|
||||
//
|
||||
arena_push_type :: (a: *Arena, type: Type): *void
|
||||
type_info := get_type_info(type)
|
||||
assert(type_info != 0)
|
||||
return arena_push_size(a, type_info.size->SizeU)
|
||||
|
||||
arena_release :: (a: *Arena)
|
||||
Os.release(&a.memory)
|
||||
|
||||
/*
|
||||
ALLOCATOR_ACTION :: enum
|
||||
ALLOCATE
|
||||
RESIZE
|
||||
FREE_ALL
|
||||
|
||||
Allocator :: struct
|
||||
proc: (a: *Allocator, action: ALLOCATOR_ACTION, size: SizeU, old_pointer: *void): *void
|
||||
|
||||
arena_allocator_proc :: (a: *Allocator, action: ALLOCATOR_ACTION, size: SizeU, old_pointer: *void): *void
|
||||
arena: *Arena = a->*Arena
|
||||
if action == ALLOCATOR_ACTION.ALLOCATE
|
||||
return arena_push_size(arena, size)
|
||||
elif action == ALLOCATOR_ACTION.RESIZE
|
||||
pass
|
||||
elif action == ALLOCATOR_ACTION.FREE_ALL
|
||||
pass
|
||||
else;; assert(false, "Invalid codepath")
|
||||
return 0
|
||||
|
||||
allocate :: (a: *Allocator, size: SizeU): *void
|
||||
return a.proc(a, ALLOCATOR_ACTION.ALLOCATE, size, 0)
|
||||
*/
|
||||
|
||||
//
|
||||
// Unicode
|
||||
|
||||
Reference in New Issue
Block a user