FloorAlign

Description

Aligns downward to the nearest multiple of align.

Prototype

template <typename T>
auto FloorAlign(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 downward.

align

Input

Alignment unit.

Return Value

T: Returns the value aligned downward 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
FloorAlign<int32_t>(12345, 4096)