18 LUG_ASSERT(size > offset,
"The size must be greater than the offset");
21 const size_t newSize = size +
sizeof(
size_t) +
sizeof(
void*);
22 const size_t newOffset = offset +
sizeof(
size_t) +
sizeof(
void*);
30 if (_current <= _currentPage->end) {
33 if (std::align(alignment, newSize - newOffset,
_current, sizeLeft)) {
37 *
static_cast<size_t*
>(
static_cast<void*
>(
static_cast<char*
>(
_current) - newSize +
sizeof(
void*))) = size;
38 *
reinterpret_cast<void**
>(
static_cast<char*
>(
_current) - newSize) = oldCurrent;
40 return static_cast<char*
>(
_current) - size;
55 void*
const oldCurrent =
reinterpret_cast<void**
>(
static_cast<char*
>(ptr) -
sizeof(
size_t))[-1];
85 return static_cast<size_t*
>(ptr)[-1];
void * allocate(size_t size, size_t alignment, size_t offset)
#define LUG_ASSERT(assertion, message)
virtual Page * requestNextPage()=0
lug::System::Memory::Area::Page * _currentPage
lug::System::Memory::Area::Page * _firstPage
lug::System::Memory::Area::Page * currentPage
Stack(lug::System::Memory::Area::IArea *area)
size_t getSize(void *ptr) const
void rewind(const Mark &mark)
lug::System::Memory::Area::IArea *const _area