carb::cpp20::bit_ceil

Defined in carb/cpp20/Bit.h

template<class T, std::enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::value, bool> = false>
constexpr T carb::cpp20::bit_ceil(T val)

Finds the smallest integral power of two not less than the given value.

See

https://en.cppreference.com/w/cpp/numeric/bit_ceil

Template Parameters

T – An unsigned integral type

Parameters

val – An unsigned integral value

Returns

The smallest integral power of two that is not smaller than val. Undefined if the resulting value is not representable in T.