carb::cpp::countr_zero
Defined in carb/cpp/Bit.h
-
template<class T, std::enable_if_t<detail::IsUnsignedIntegral<T>::value, bool> = false>
int carb::cpp::countr_zero(T val) noexcept Returns the number of consecutive 0 bits in the value of val, starting from the least significant bit (“right”).
Note
Unlike std::countr_zero, this function is not constexpr. This is because the compiler intrinsics used to implement this function are not constexpr until C++20, so it was decided to drop constexpr in favor of being able to use compiler intrinsics. If a constexpr implementation is required, use countr_zero_constexpr().
- Template Parameters
T – An unsigned integral type
- Parameters
val – An unsigned integral value
- Returns
The number of consecutive 0 bits in the provided value, starting from the least significant bit.