UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AlignmentTemplates.h File Reference
#include "CoreTypes.h"
#include "Templates/IsIntegral.h"
#include "Templates/IsPointer.h"

Go to the source code of this file.

Functions

template<typename T >
constexprAlign (T Val, uint64 Alignment)
 
template<typename T >
constexprAlignDown (T Val, uint64 Alignment)
 
template<typename T >
constexpr bool IsAligned (T Val, uint64 Alignment)
 
template<typename T >
constexprAlignArbitrary (T Val, uint64 Alignment)
 

Function Documentation

◆ Align()

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

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.

◆ AlignArbitrary()

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

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.

◆ AlignDown()

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

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.

◆ IsAligned()

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

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.