has_single_bit

has_single_bit#

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

◆ has_single_bit()

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

Determines whether the number is a power of two.

Parameters
[in]numberA number
Returns
True if number is a power of two, false otherwise