Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
common.hpp File Reference
#include <helios/assert.hpp>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string_view>

Go to the source code of this file.

Classes

struct  helios::mem::GrowthPolicy
 Capacity growth configuration. More...
struct  helios::mem::AllocatorStats
 Runtime statistics snapshot for PMR allocators. More...

Namespaces

namespace  helios
namespace  helios::mem

Enumerations

enum class  helios::mem::GrowthMode : uint8_t { helios::mem::kLinear , helios::mem::kGeometric }
 Growth strategy used by growable allocators. More...
enum class  helios::mem::MemoryError : uint8_t {
  helios::mem::kOutOfMemory , helios::mem::kInvalidAlignment , helios::mem::kInvalidSize , helios::mem::kGrowthDisabled ,
  helios::mem::kOwnershipMismatch
}
 Error codes used for explicit non-fatal memory operations. More...

Functions

constexpr size_t helios::mem::SaturatingAdd (size_t lhs, size_t rhs) noexcept
 Saturating add for size_t.
constexpr size_t helios::mem::SaturatingMul (size_t lhs, size_t rhs) noexcept
 Saturating multiply for size_t.
constexpr std::string_view helios::mem::MemoryErrorToString (MemoryError error) noexcept
 Converts MemoryError to a readable string.
constexpr bool helios::mem::IsPowerOfTwo (size_t value) noexcept
 Checks if a value is a power of two.
constexpr size_t helios::mem::AlignUp (size_t value, size_t alignment) noexcept
 Aligns value up to alignment.
void * helios::mem::AlignUpPtr (void *ptr, size_t alignment) noexcept
 Aligns pointer up to alignment.
bool helios::mem::IsAligned (const void *ptr, size_t alignment) noexcept
 Checks if pointer is aligned.
size_t helios::mem::CalculatePadding (const void *ptr, size_t alignment) noexcept
 Computes padding required for pointer alignment.
size_t helios::mem::CalculatePaddingWithHeader (const void *ptr, size_t alignment, size_t header_size) noexcept
 Computes padding for aligned storage with a prepended header.

Variables

constexpr size_t helios::mem::kDefaultAlignment = 64
 Default alignment used by memory resources.
constexpr size_t helios::mem::kMinAlignment = alignof(std::max_align_t)
 Minimum alignment used by memory resources.