CeilAlign

Description

Aligns upward to the nearest multiple of align.

Prototype

template <typename T>
auto CeilAlign(T x, T align) -> typename std::enable_if<std::is_integral<T>::value, T>::type

Parameters

Parameter

Input/Output

Description

x

Input

Value to be aligned upward.

align

Input

Alignment unit.

Return Value

T: Returns the value aligned upward to the nearest multiple of align. If align is 0, 0 is returned.

Constraints

The value to be aligned and the alignment unit must be integers of the same type (excluding the bool type).

Example

The following sample code is for reference only. Do not copy and run it.

1
CeilAlign<int32_t>(1000, 64)