10     , 
"Block size has changed, check algorithms");
 
   14     FMagicHeader(MAGIC_HEADER),
 
   16     FSizeAndFreeBit(InitializeData(ASpaceAvailable, AFree)),
 
   17     FOffsetToPreviousBlock(CalculateOffset(ALeftBlock))
 
   19     ,FMagicFooter(MAGIC_FOOTER)
 
   22     API::Assert::LessThanOrEqual<unsigned long long>(
sizeof(
Block), ASpaceAvailable);
 
   26     const auto DataSize(static_cast<long long>(ASize - 
sizeof(
Block)));
 
   27     API::Assert::LessThanOrEqual<long long>(0, DataSize);
 
   28     API::Assert::LessThanOrEqual<long long>(DataSize, std::numeric_limits<int>().max());
 
   30         return static_cast<unsigned int>(DataSize) | 1U << 31;
 
   31     return static_cast<unsigned int>(DataSize) & ~(1U << 31);
 
   35     API::Assert::LessThanOrEqual<const Block*>(&ABlock, 
this);
 
   36     const auto Result(reinterpret_cast<byte*>(
this) - reinterpret_cast<const byte*>(&ABlock));
 
   37     API::Assert::LessThanOrEqual<long long>(Result, std::numeric_limits<unsigned int>().max());
 
   38     return static_cast<unsigned int>(Result);
 
   48     return (FSizeAndFreeBit >> 31) & 1;
 
   52     return IsFree() && Size() == 0;
 
   60     Block& TheBlock(*reinterpret_cast<Block*>(static_cast<byte*>(AData) - 
sizeof(
Block)));
 
   66     if (FOffsetToPreviousBlock == 0)
 
   68     return reinterpret_cast<Block*
>(
reinterpret_cast<byte*
>(
this) - FOffsetToPreviousBlock);
 
   73     return *
reinterpret_cast<Block*
>(
static_cast<byte*
>(GetData()) + Size());
 
   78     return *
reinterpret_cast<const Block*
>(
reinterpret_cast<const byte*
>(
this) + 
sizeof(
Block) + Size());
 
   82     FSizeAndFreeBit = FSizeAndFreeBit - Size() + ANewSize;
 
   86         FSizeAndFreeBit |= 1U << 31;
 
   88         FSizeAndFreeBit &= ~(1U << 31);
 
   93     API::Assert::Equal<unsigned long long>(FMagicHeader, MAGIC_HEADER);
 
   94     API::Assert::Equal<unsigned long long>(FMagicFooter, MAGIC_FOOTER);
 
  101     const auto NewBlockAmount(Size() - ASizeToKeep);
 
  102     API::Assert::LessThan<unsigned long long>(
sizeof(
Block), NewBlockAmount);
 
  103     SetSize(ASizeToKeep);
 
  104     auto& Result(*API::Interop::Allocator::InPlaceAllocation<Block>(static_cast<byte*>(GetData()) + ASizeToKeep, static_cast<unsigned int>(NewBlockAmount), *
this, 
true));
 
  105     Result.RightBlock().FOffsetToPreviousBlock = Result.RightBlock().CalculateOffset(Result);
 
  111     API::Assert::NotEqual<Block*>(LeftBlock(), 
nullptr);
 
  113     auto& LBlock(*LeftBlock());
 
  114     const auto NewSize(LBlock.Size() + Size() + 
sizeof(
Block));
 
  115     API::Assert::LessThan<unsigned long long>(NewSize, 
static_cast<unsigned long long>(std::numeric_limits<int>::max()));
 
  116     LBlock.SetSize(static_cast<unsigned int>(NewSize));
 
  117     LBlock.RightBlock().FOffsetToPreviousBlock = LBlock.RightBlock().CalculateOffset(LBlock);
 
bool IsFree(void) const noexcept
Check if this Block is free. 
unsigned char byte
It's a byte, 8 bits, etc... 
Block & EatLeftBlock(void) noexcept
Merge size and header into the size of the Block to the left. Does not modify free lists...
#define DEBUG
Should be defined or not by user before all inclusions of CyberEngine.hpp. Enables engine debugging l...
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. 
static void LessThan(const AType &ALHS, const AType &ARHS) noexcept
Less than assertion function. May not be evaluated. 
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. 
static void Equal(const AType &ALHS, const AType &ARHS) noexcept
Equivalence assertion function. May not be evaluated. 
unsigned int CalculateOffset(const Block &ABlock) noexcept
Calculate the byte offset to another Block. 
Precompiled header for inter-engine operations. 
static void False(const bool AExpression) noexcept
False assertion function. AExpression should always be evaluated. 
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.