bit_mod

bit_mod#

stdgpu: stdgpu::bit_mod
stdgpu Latest
Efficient STL-like Data Structures on the GPU

◆ bit_mod()

template<typename T , STDGPU_DETAIL_OVERLOAD_IF(std::is_unsigned_v< T >) >
STDGPU_HOST_DEVICE T stdgpu::bit_mod ( const T  number,
const T  divider 
)
noexcept

Computes the modulus of the given number and a power of two divider.

Parameters
[in]numberA number
[in]dividerThe divider with divider = 2^n
Returns
The modulos of the given number and divider
Precondition
has_single_bit(divider)
Postcondition
result >= 0
result < divider