|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
计算位中1的个数和前导零个数 更多...
函数 | |
| constexpr int | popcount32 (const uint32_t x) noexcept |
| 计算32位整数中1的个数 | |
| MSTL_CONSTEXPR14 int | clz32 (uint32_t x) noexcept |
| 计算32位整数前导零的个数 | |
| constexpr int | popcount (const uintptr_t x) noexcept |
| 计算整数中1的个数 | |
| constexpr int | countl_zero (const uintptr_t x) noexcept |
| 计算整数前导零的个数 | |
| constexpr int | countl_one (const uintptr_t x) noexcept |
| 计算整数前导1的个数 | |
| constexpr int | countr_zero (const uintptr_t x) noexcept |
| 计算整数尾随零的个数 | |
| constexpr int | countr_one (const uintptr_t x) noexcept |
| 计算整数尾随1的个数 | |
| constexpr int | lowest_set_bit_pos (const intptr_t x) noexcept |
| 获取最低设置位的位置,从0开始 | |
| MSTL_CONSTEXPR14 int | highest_set_bit_pos (const intptr_t x) noexcept |
| 获取最高设置位的位置 | |
| MSTL_CONSTEXPR14 bool | parity32 (uint32_t x) noexcept |
| 计算32位整数的奇偶性 | |
| constexpr bool | parity (const uintptr_t x) noexcept |
| 计算整数的奇偶性 | |
计算位中1的个数和前导零个数
|
noexcept |
计算32位整数前导零的个数
| x | 32位无符号整数 |
使用二分查找法优化前导零计数。
被这些函数引用 countl_zero() , 以及 highest_set_bit_pos().
|
constexprnoexcept |
|
constexprnoexcept |
计算整数前导零的个数
| x | 无符号整数 |
根据平台位数调用相应的clz函数。
引用了 clz32().
被这些函数引用 bit_width() , 以及 countl_one().
|
constexprnoexcept |
|
constexprnoexcept |
计算整数尾随零的个数
| x | 无符号整数 |
使用位运算技巧得到最低有效位的掩码。
引用了 popcount().
被这些函数引用 countr_one() , 以及 lowest_set_bit_pos().
|
noexcept |
|
constexprnoexcept |
|
constexprnoexcept |
|
noexcept |
|
constexprnoexcept |
|
constexprnoexcept |