bit_width

bit_width#

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

◆ bit_width()

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

Computes the smallest number of bits to represent the given number.

Parameters
[in]numberA number
Returns
The smallest number of bits to represent the given number
Postcondition
result >= 0
result <= numeric_limits<T>::digits