aboutsummaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-01-25 19:19:25 +0000
committerGinger Bill <bill@gingerbill.org>2017-01-25 19:19:25 +0000
commitb59a052e32b1ed84134e31baad86c8e401f796c6 (patch)
tree9aef601f0d9a25e43fe046f274508bf774dad9a2 /src/common.c
parent12498b2d390c95fd49672f8ee1c64b7b254c293c (diff)
Change casting syntax: `cast(T)x` `transmute(T)x` et al.
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c11
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) {