|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
MSTL位操作函数 更多...
#include "MSTL/core/typeinfo/types.hpp"命名空间 | |
| namespace | constants |
| 计算用常量命名空间 | |
函数 | |
| 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 |
| 计算整数的奇偶性 | |
| constexpr int | bit_width (const uintptr_t x) noexcept |
| 计算表示整数所需的最小位宽 | |
| constexpr uintptr_t | bit_floor (const uintptr_t x) noexcept |
| 获取不大于x的最大2的幂 | |
| MSTL_CONSTEXPR14 uint64_t | bit_ceil (const uintptr_t x) noexcept |
| 获取不小于x的最小2的幂 | |
| constexpr bool | has_single_bit (const uintptr_t x) noexcept |
| 检查整数是否为2的幂 | |
| MSTL_CONSTEXPR14 uint32_t | rotate_l32 (const uint32_t x, const int s) noexcept |
| 32位整数循环左移 | |
| MSTL_CONSTEXPR14 uint32_t | rotate_r32 (const uint32_t x, const int s) noexcept |
| 32位整数循环右移 | |
| MSTL_CONSTEXPR14 int | rotate_l (const uintptr_t x, const int s) noexcept |
| 整数循环左移 | |
| MSTL_CONSTEXPR14 int | rotate_r (const uintptr_t x, const int s) noexcept |
| 整数循环右移 | |
| constexpr uintptr_t | bit_extract (const uintptr_t x, const int pos, const int len) noexcept |
| 从整数中提取指定位段 | |
| MSTL_CONSTEXPR14 uintptr_t | bit_insert (const uintptr_t x, const uintptr_t bits, const int pos, const int len) noexcept |
| 向整数中插入指定位段 | |
| MSTL_CONSTEXPR14 uint32_t | reverse_bits32 (uint32_t x) noexcept |
| 反转32位整数的位顺序 | |
| constexpr uintptr_t | reverse_bits (const uintptr_t x) noexcept |
| 反转整数的位顺序 | |
| constexpr uintptr_t | mask_from_to (const int from, const int to) noexcept |
| 生成从from到to的位掩码 | |