summaryrefslogtreecommitdiff
path: root/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'memory.cpp')
-rw-r--r--memory.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/memory.cpp b/memory.cpp
index 2a9b29b..85c6610 100644
--- a/memory.cpp
+++ b/memory.cpp
@@ -25,6 +25,18 @@ AllocateMemory(memory *Memory, uint64 Size, memory_table_list TableName) {
return Address;
}
+// Returns the address without advancing
+static void*
+Memory_GetAddressAt(memory *Memory, uint64 Size, memory_table_list TableName) {
+ void *Address;
+ memory_table *Table = &Memory->Slot[TableName];
+ if (Table->CurrentPosition + Size > Table->Size) {
+ return NULL;
+ }
+ Address = (ptrsize *)((uint8 *)Table->Address + Table->CurrentPosition + Size);
+ return Address;
+}
+
// Returns the address and THEN advances
static void*
Memory_Advance(memory *Memory, uint64 Size, memory_table_list TableName) {