9 enum :
unsigned long long {
10 MAGIC_HEADER = 0x0123456789ABCDEF,
11 MAGIC_FOOTER = 0xFEDCBA9876543210,
14 #ifdef DEBUG //Block debug headers
16 unsigned long long FMagicHeader;
24 unsigned long long FMagicFooter;
35 static unsigned int InitializeData(
const unsigned int ASize,
const bool AFree) noexcept;
62 Block(
const unsigned int ASpaceAvailable,
const Block& ALeftBlock,
const bool AFree) noexcept;
101 void SetSize(const
unsigned int ANewSize) noexcept;
108 void SetFree(const
bool ANewFree) noexcept;
116 bool IsFree(
void) const noexcept;
123 unsigned int Size(
void) const noexcept;
147 Block&
Splice(const
unsigned int ASizeToKeep) noexcept;
bool IsFree(void) const noexcept
Check if this Block is free.
Block & EatLeftBlock(void) noexcept
Merge size and header into the size of the Block to the left. Does not modify free lists...
Block & RightBlock(void) noexcept
Get the block to the right of this Block.
Block(const unsigned int ASpaceAvailable, const Block &ALeftBlock, const bool AFree) noexcept
Create a Block. Should be used with operator new in a memory location at least ASpaceAvailable large...
void SetFree(const bool ANewFree) noexcept
Set the Block's free state.
Block & Splice(const unsigned int ASizeToKeep) noexcept
Separate this block into two.
void * GetData(void) noexcept
Get the data portion of the memory owned by this Block.
static unsigned int InitializeData(const unsigned int ASize, const bool AFree) noexcept
Returns the Size and Free integer given a size and free state.
void SetSize(const unsigned int ANewSize) noexcept
Set the Block's size.
static Block & FromData(void *const AData)
Retrieves a reference to a Block given it's data pointer.
bool IsLargeBlock(void) const noexcept
Check if this Block is a LargeBlock.
unsigned int CalculateOffset(const Block &ABlock) noexcept
Calculate the byte offset to another Block.
unsigned int FOffsetToPreviousBlock
The offset from the block behind it.
void Validate(void) const
Checks the validity of a Block HCFs if invalid. Has no effect outside of DEBUG mode.
Block * LeftBlock(void) noexcept
Get the block to the left of this Block.
A unit of memory allocation.
unsigned int Size(void) const noexcept
Get the size of the Block.
unsigned int FSizeAndFreeBit
The size of this block and it's free bit.
Block * FNextFree
The next block in the free list.