summaryrefslogtreecommitdiffstats
path: root/omni/memory.h
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-04-16 17:01:13 +0200
committerFabrice <fabrice@schaub-dev.xyz>2026-04-16 17:01:13 +0200
commit4748386b4e22a5bfe0c4d3f0d65c43f37e09536e (patch)
tree5fc64c585470ea15f93b4168ef846a447e2e0538 /omni/memory.h
parent70dfff41ce5d50264ca419724c038e8acc8df753 (diff)
progress on the allocator
Diffstat (limited to 'omni/memory.h')
-rw-r--r--omni/memory.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/omni/memory.h b/omni/memory.h
new file mode 100644
index 0000000..def1cc0
--- /dev/null
+++ b/omni/memory.h
@@ -0,0 +1,25 @@
+#ifndef OMNI_MEMORY_H
+#define OMNI_MEMORY_H
+
+#include "stdint.h"
+
+struct Layout {
+ usize size;
+ usize align;
+
+ template <typename T>
+ constexpr static Layout of(usize n) noexcept {
+ return Layout{n * sizeof(T), alignof(T)};
+ }
+
+ static bool from(usize size, usize align) noexcept {
+ return Layout{size, align};
+ }
+};
+
+struct Allocator {
+ virtual u8* allocate(Layout layout) noexcept;
+ virtual void deallocate(u8* ptr);
+};
+
+#endif