Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
AlignmentTemplates.h File Reference
#include "../BasicTypes.h"
+ Include dependency graph for AlignmentTemplates.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
CONSTEXPRAlign (const T Ptr, int32 Alignment)
 
template<typename T >
CONSTEXPRAlignDown (const T Ptr, int32 Alignment)
 
static FORCEINLINE bool IsAligned (const volatile void *Ptr, const uint32 Alignment)
 
template<class T >
AlignArbitrary (const T Ptr, uint32 Alignment)
 

Function Documentation

◆ Align()

template<typename T >
CONSTEXPR T Align ( const T Ptr,
int32 Alignment )
inline

Aligns a value to the nearest higher multiple of 'Alignment', which must be a power of two.

Parameters
PtrValue to align
AlignmentAlignment, must be a power of two
Returns
Aligned value

Definition at line 15 of file AlignmentTemplates.h.

+ Here is the caller graph for this function:

◆ AlignArbitrary()

template<class T >
T AlignArbitrary ( const T Ptr,
uint32 Alignment )
inline

Aligns a value to the nearest higher multiple of 'Alignment'.

Parameters
PtrValue to align
AlignmentAlignment, can be any arbitrary uint32
Returns
Aligned value

Definition at line 52 of file AlignmentTemplates.h.

◆ AlignDown()

template<typename T >
CONSTEXPR T AlignDown ( const T Ptr,
int32 Alignment )
inline

Aligns a value to the nearest lower multiple of 'Alignment', which must be a power of two.

Parameters
PtrValue to align
AlignmentAlignment, must be a power of two
Returns
Aligned value

Definition at line 28 of file AlignmentTemplates.h.

◆ IsAligned()

static FORCEINLINE bool IsAligned ( const volatile void * Ptr,
const uint32 Alignment )
static

Checks if a pointer is aligned to the specified alignment.

Parameters
Ptr- The pointer to check.
Returns
true if the pointer is aligned, false otherwise.

Definition at line 40 of file AlignmentTemplates.h.