3 #ifdef TARGET_OS_WINDOWS
4 #pragma warning(disable : 4355) //this used in initalizer list
13 ,
"LargeBlock size has changed, check algorithms");
16 Block(
sizeof(
Block), ALeftBlock ==
nullptr ? *
this : *ALeftBlock,
true),
18 FMagicHeader(MAGIC_HEADER),
20 FRemainingSize(ASpaceAvailable)
22 ,FMagicFooter(MAGIC_FOOTER)
27 const auto SizeWithBlock(ANewBlockSize +
sizeof(
Block));
28 const auto OriginalSize(ALargeBlock->FRemainingSize);
29 API::Assert::LessThan<unsigned long long>(SizeWithBlock, OriginalSize);
30 Block& NewBlock(*API::Interop::Allocator::InPlaceAllocation<Block>(ALargeBlock, static_cast<unsigned int>(SizeWithBlock), ALargeBlock->LeftBlock() ==
nullptr ? *ALargeBlock : *ALargeBlock->LeftBlock(),
false));
31 ALargeBlock = API::Interop::Allocator::InPlaceAllocation<LargeBlock>(
reinterpret_cast<byte*
>(&NewBlock) + SizeWithBlock, OriginalSize - SizeWithBlock, &NewBlock);
37 API::Assert::Equal<unsigned long long>(FMagicHeader, MAGIC_HEADER);
38 API::Assert::Equal<unsigned long long>(FMagicFooter, MAGIC_FOOTER);
44 API::Assert::NotEqual<Block*>(LeftBlock(),
nullptr);
45 return *API::Interop::Allocator::InPlaceAllocation<LargeBlock>(LeftBlock(), FRemainingSize + LeftBlock()->Size() +
sizeof(
Block), LeftBlock()->LeftBlock());
49 return FRemainingSize;
53 FRemainingSize = ANewSize;
LargeBlock(const unsigned long long ASpaceAvailable, Block *const ALeftBlock) noexcept
Initialization constructor. Should be used with operator new in a memory location at least ASpaceAvai...
unsigned char byte
It's a byte, 8 bits, etc...
#define DEBUG
Should be defined or not by user before all inclusions of CyberEngine.hpp. Enables engine debugging l...
Used to identify the end of a Heap.
unsigned long long Size(void) const noexcept
Get the size of the Block. This version must be used when referring to large blocks ...
static Block & AllocateBlock(LargeBlock *&ALargeBlock, const unsigned int ANewBlockSize) noexcept
Allocate a portion of the LargeBlock's owned data to create a regular block.
void SetSize(const unsigned long long ANewSize) noexcept
Set the Block's size. This version must be used when referring to large blocks
void Validate(void) const
Checks the validity of a Block HCFs if invalid. Has no effect outside of DEBUG mode. This version must be used when referring to large blocks
Precompiled header for inter-engine operations.
void Validate(void) const
Checks the validity of a Block HCFs if invalid. Has no effect outside of DEBUG mode.
A unit of memory allocation.
LargeBlock & EatLeftBlock(void) noexcept
Merge size and header into the size of the Block to the left. Does not modify free lists...