diff options
author | aap <aap@papnet.eu> | 2020-11-25 22:49:50 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-11-25 22:49:50 +0100 |
commit | 4ddc35634160da5779c46ab63a5b3d351af50b83 (patch) | |
tree | 9e38a65296bb049d0292948c135ef8f3a939df9b /src/rw/MemoryHeap.h | |
parent | implemented CMemoryHeap, not used or tested yet (diff) | |
download | re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar.gz re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar.bz2 re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar.lz re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar.xz re3-4ddc35634160da5779c46ab63a5b3d351af50b83.tar.zst re3-4ddc35634160da5779c46ab63a5b3d351af50b83.zip |
Diffstat (limited to '')
-rw-r--r-- | src/rw/MemoryHeap.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rw/MemoryHeap.h b/src/rw/MemoryHeap.h index 840e016a..3f6fb5a0 100644 --- a/src/rw/MemoryHeap.h +++ b/src/rw/MemoryHeap.h @@ -1,6 +1,12 @@ #pragma once +// some windows shit +#ifdef MoveMemory +#undef MoveMemory +#endif + extern RwMemoryFunctions memFuncs; +void InitMemoryMgr(void); template<typename T, uint32 N> class CStack @@ -56,7 +62,10 @@ struct HeapBlockDesc } }; +#ifdef USE_CUSTOM_ALLOCATOR +// TODO: figure something out for 64 bit pointers static_assert(sizeof(HeapBlockDesc) == 0x10, "HeapBlockDesc must have 0x10 size otherwise most of assumptions don't make sense"); +#endif struct HeapBlockList { @@ -181,8 +190,7 @@ public: return; } } - HeapBlockDesc *it; - for(it = m_freeList.m_first.m_next; it->m_size < block->m_size; it = it->m_next); - block->InsertHeapFreeBlock(it->m_prev); + HeapBlockDesc *b = m_freeList.m_first.FindSmallestFreeBlock(block->m_size); + block->InsertHeapFreeBlock(b->m_prev); } }; |