Template Function nvcv::detail::AlignDown

Function Documentation

template<typename T>
constexpr T nvcv::detail::AlignDown(T value, T alignment_pow2)

Aligns the value down to a multiple of alignment_pow2.

The function operates by masking the least significant bits of the value. If the alignment is not a power of two, the behavior is undefined.

Remark

Negative values are aligned down, not towards zero.

Template Parameters:

T – an integral type

Parameters:
  • value – a value to align

  • alignment_pow2 – the alignment, must be a positive power of 2

Returns:

constexpr T the value aligned down to a multiple of alignment_pow2