| 94 | // 得到 bit 中左(高位起)和右(低位起)的 0 个数 |
| 95 | template <typename T> |
| 96 | SKR_INLINE constexpr T countl_zero(T v) |
| 97 | { |
| 98 | static_assert(std::is_integral_v<T> && !std::is_signed_v<T>); |
| 99 | #if SKR_CXX_VERSION >= 20 |
| 100 | return std::countl_zero(v); |
| 101 | #else |
| 102 | return detail::countl_zero_fallback(v); |
| 103 | #endif |
| 104 | } |
| 105 | template <typename T> |
| 106 | SKR_INLINE constexpr T countr_zero(T v) |
| 107 | { |
no test coverage detected