popcount

popcount#

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

◆ popcount()

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

Counts the number of set bits in the number.

Parameters
[in]numberA number
Returns
The number of set bits
Postcondition
result >= 0
result <= numeric_limits<T>::digits