Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
alignment.h File Reference
#include "lib/sysdep/compiler.h"
#include "lib/sysdep/arch.h"
#include <cstdint>
Include dependency graph for alignment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALIGNED(type, multiple)   type
 
#define VECTOR_ALIGNED(type)   ALIGNED(type, 16)
 
#define ASSERT_VECTOR_MULTIPLE(size)    ASSERT(IsAligned(size, vectorSize))
 
#define ASSERT_VECTOR_ALIGNED(pointer)
 
#define CACHE_ALIGNED(type)   ALIGNED(type, 64)
 

Functions

template<typename T >
bool IsAligned (T t, uintptr_t multiple)
 
template<size_t multiple>
size_t Align (size_t n)
 

Variables

static const size_t vectorSize = 16
 
static const size_t cacheLineSize = 64
 
static const size_t g_PageSize = 64 * 1024
 
static const size_t g_LargePageSize = 2 * 1024 * 1024
 
static const size_t allocationAlignment = 16
 
static const size_t KiB = size_t(1) << 10
 
static const size_t MiB = size_t(1) << 20
 
static const size_t GiB = size_t(1) << 30
 
static const uintptr_t maxSectorSize = 0x1000
 

Macro Definition Documentation

◆ ALIGNED

#define ALIGNED (   type,
  multiple 
)    type

◆ ASSERT_VECTOR_ALIGNED

#define ASSERT_VECTOR_ALIGNED (   pointer)
Value:
ASSUME_ALIGNED(pointer, vectorSize)
#define ASSERT_VECTOR_MULTIPLE(size)
Definition: alignment.h:63
static const size_t vectorSize
Definition: alignment.h:60

◆ ASSERT_VECTOR_MULTIPLE

#define ASSERT_VECTOR_MULTIPLE (   size)     ASSERT(IsAligned(size, vectorSize))

◆ CACHE_ALIGNED

#define CACHE_ALIGNED (   type)    ALIGNED(type, 64)

◆ VECTOR_ALIGNED

#define VECTOR_ALIGNED (   type)    ALIGNED(type, 16)

Function Documentation

◆ Align()

template<size_t multiple>
size_t Align ( size_t  n)
inline

◆ IsAligned()

template<typename T >
bool IsAligned ( T  t,
uintptr_t  multiple 
)
inline

Variable Documentation

◆ allocationAlignment

const size_t allocationAlignment = 16
static

◆ cacheLineSize

const size_t cacheLineSize = 64
static

◆ g_LargePageSize

const size_t g_LargePageSize = 2 * 1024 * 1024
static

◆ g_PageSize

const size_t g_PageSize = 64 * 1024
static

◆ GiB

const size_t GiB = size_t(1) << 30
static

◆ KiB

const size_t KiB = size_t(1) << 10
static

◆ maxSectorSize

const uintptr_t maxSectorSize = 0x1000
static

◆ MiB

const size_t MiB = size_t(1) << 20
static

◆ vectorSize

const size_t vectorSize = 16
static