diff options
Diffstat (limited to 'memory.cpp')
-rw-r--r-- | memory.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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) { |