mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +02:00
CTFE updates, including heap support
This commit is contained in:
parent
792d92d014
commit
6bb363fb4b
29 changed files with 3050 additions and 595 deletions
32
BeefySysLib/util/Heap.h
Normal file
32
BeefySysLib/util/Heap.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Common.h"
|
||||
|
||||
NS_BF_BEGIN
|
||||
|
||||
class ContiguousHeap
|
||||
{
|
||||
public:
|
||||
typedef int AllocRef;
|
||||
|
||||
public:
|
||||
void* mMetadata;
|
||||
|
||||
int mMemorySize;
|
||||
int mBlockDataOfs;
|
||||
Array<AllocRef> mFreeList;
|
||||
int mFreeIdx;
|
||||
|
||||
public:
|
||||
ContiguousHeap();
|
||||
virtual ~ContiguousHeap();
|
||||
|
||||
void Clear(int maxAllocSize = -1);
|
||||
|
||||
AllocRef Alloc(int size);
|
||||
bool Free(AllocRef ref);
|
||||
|
||||
void DebugDump();
|
||||
};
|
||||
|
||||
NS_BF_END
|
Loading…
Add table
Add a link
Reference in a new issue