aboutsummaryrefslogtreecommitdiff
path: root/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'memory.h')
-rw-r--r--memory.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/memory.h b/memory.h
new file mode 100644
index 0000000..e1c5fdd
--- /dev/null
+++ b/memory.h
@@ -0,0 +1,15 @@
+#include <stddef.h>
+
+#ifndef MEMORY_H
+#define MEMORY_H
+typedef struct {
+ ptrdiff_t cap;
+ char *beg;
+ char *end;
+} Arena;
+
+Arena Arena_new(ptrdiff_t cap);
+#define new(a, T, n) (T *)alloc(a, n, sizeof(T), _Alignof(T))
+void *alloc(Arena *a, ptrdiff_t count, int size, int align);
+int Arena_get_used(Arena a);
+#endif