#include <bitset>
bitset<16> second(177);
bitset<16> third("1110011"); //将二进制字符串初始化到对象中
a.to_ulong() //转成32位无符号整数
a.to_ullong() // 转换为64位无符号整数,如果超出范围则报错
a.to_string() // 转换为string
int t = 1 << n; // 2的n次方
int low_bit = hash & 1; // 获取最低位
int low_four = (hash & 0xf)// 获取低四位
int high_four = (hash >> (TOTAL_BITS-4)) // 获取高四位

如果喜欢请点赞收藏投币,谢谢!