#pragma once

// ::Types::

constexpr usize ARENA_HEADER_SIZE = 32;

typedef struct Arena
{
	u8		*buffer;
	usize length;
	usize pos;
	u32   init_line_no;
} Arena;

// ::Allocator::Util::Header::

static inline usize CalcPaddingWithHeader(uintptr ptr, uintptr alignment, usize header_size);
static inline usize CalcPadding(uintptr ptr, uintptr alignment);

// ::Allocator::Arena::Header::

static Arena *ArenaInit(rawptr buffer, usize size);
static Arena *ArenaCreate(usize size);
static Arena *ArenaCreateDebug(usize size, u32 init_line_no);
static Arena *ArenaInitDebug(rawptr buffer, usize size, u32 init_line_no);
static rawptr ArenaAllocAlign(Arena *arena, usize size, usize align);
static rawptr ArenaAlloc(Arena *arena, usize size);
static void ArenaFree(Arena *arena);
static void ArenaFreeZeroed(Arena *arena);
static void DeallocArena(Arena *arena);
