Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
AlignmentTemplates.h File Reference
#include "CoreTypes.h"
#include "Templates/IsIntegral.h"
#include "Templates/IsPointer.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 >
FORCEINLINE constexpr T Align (T Val, uint64 Alignment)
 
template<typename T >
FORCEINLINE constexpr T AlignDown (T Val, uint64 Alignment)
 
template<typename T >
FORCEINLINE constexpr bool IsAligned (T Val, uint64 Alignment)
 
template<typename T >
FORCEINLINE constexpr T AlignArbitrary (T Val, uint64 Alignment)
 

Function Documentation

◆ Align()

template<typename T >
FORCEINLINE constexpr T Align ( T Val,
uint64 Alignment )
constexpr

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

Parameters
ValThe value to align.
AlignmentThe alignment value, must be a power of two.
Returns
The value aligned up to the specified alignment.

Definition at line 18 of file AlignmentTemplates.h.

◆ AlignArbitrary()

template<typename T >
FORCEINLINE constexpr T AlignArbitrary ( T Val,
uint64 Alignment )
constexpr

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

Parameters
ValThe value to align.
AlignmentThe alignment value, can be any arbitrary value.
Returns
The value aligned up to the specified alignment.

Definition at line 66 of file AlignmentTemplates.h.

◆ AlignDown()

template<typename T >
FORCEINLINE constexpr T AlignDown ( T Val,
uint64 Alignment )
constexpr

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

Parameters
ValThe value to align.
AlignmentThe alignment value, must be a power of two.
Returns
The value aligned down to the specified alignment.

Definition at line 34 of file AlignmentTemplates.h.

◆ IsAligned()

template<typename T >
FORCEINLINE constexpr bool IsAligned ( T Val,
uint64 Alignment )
constexpr

Checks if a pointer is aligned to the specified alignment.

Parameters
ValThe value to align.
AlignmentThe alignment value, must be a power of two.
Returns
true if the pointer is aligned to the specified alignment, false otherwise.

Definition at line 50 of file AlignmentTemplates.h.