10#ifndef COMMON_UTILS_BINARY_HPP
11#define COMMON_UTILS_BINARY_HPP
26uint BytesToInt(
const std::vector<byte>& bytes,
bool big_endian =
true);
89 std::vector<byte>
bytes;
92 for (
int i =
sizeof(
number) - 1;
i >= 0; --
i)
98 return std::move(
bytes);
std::vector< byte > IntToBytes(uint number, bool big_endian=true)
将整数转换为字节数组
uint BytesToInt(const std::vector< byte > &bytes, bool big_endian=true)
将字节数组转换为整数
unsigned short ushort
无符号短整型
uint WriteBit(uint number, ushort bit, bool value)
设置数字中特定位的值
bool ReadBit(uint number, ushort bit)
读取数字中特定位的值