diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-01-25 19:19:25 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-01-25 19:19:25 +0000 |
| commit | b59a052e32b1ed84134e31baad86c8e401f796c6 (patch) | |
| tree | 9aef601f0d9a25e43fe046f274508bf774dad9a2 /src/common.c | |
| parent | 12498b2d390c95fd49672f8ee1c64b7b254c293c (diff) | |
Change casting syntax: `cast(T)x` `transmute(T)x` et al.
Diffstat (limited to 'src/common.c')
| -rw-r--r-- | src/common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index a43ee9d32..e2a70f576 100644 --- a/src/common.c +++ b/src/common.c @@ -12,6 +12,17 @@ gbAllocator heap_allocator(void) { gb_global String global_module_path = {0}; gb_global bool global_module_path_set = false; +gb_global gbScratchMemory scratch_memory = {0}; + +void init_scratch_memory(isize size) { + void *memory = gb_alloc(heap_allocator(), size); + gb_scratch_memory_init(&scratch_memory, memory, size); +} + +gbAllocator scratch_allocator(void) { + return gb_scratch_allocator(&scratch_memory); +} + i64 next_pow2(i64 n) { if (n <= 0) { |