summaryrefslogtreecommitdiff
path: root/src/std/mem.h
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-25 17:36:36 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-25 17:36:36 +1100
commit06ed6edcedf30fd8f7e036fffe8f81e8ca89d4b0 (patch)
treef5ae75e431817a53ee5725b4c0d6f3e61b15a664 /src/std/mem.h
parent109b6dd1881d90915e972f0d263a032bd262adb5 (diff)
parentb5b7cea24c46d28a4b72bc18ca8ccb2d532007d3 (diff)
Merge branch 'master' of github.com:omnisci3nce/celeritas-core
Diffstat (limited to 'src/std/mem.h')
-rw-r--r--src/std/mem.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/std/mem.h b/src/std/mem.h
index 74222a7..c3ec61d 100644
--- a/src/std/mem.h
+++ b/src/std/mem.h
@@ -9,6 +9,17 @@
*/
#pragma once
-#include "defines.h"
+#include <stddef.h>
-typedef void* (*alloc)(size_t amount); \ No newline at end of file
+// Inspired by https://nullprogram.com/blog/2023/09/27/
+typedef struct arena {
+ char* begin;
+ char* curr;
+ char* end;
+} arena;
+
+arena arena_create(void* backing_buffer, size_t capacity);
+void* arena_alloc(arena* a, size_t size);
+void* arena_alloc_align(arena* a, size_t size, size_t align);
+void arena_free_all(arena* a);
+// TODO: arena_resize \ No newline at end of file