T_Cyjb_ByteUtil - CYJB/Cyjb GitHub Wiki
提供对 Byte 的扩展方法。
System.Object
Cyjb.ByteUtil
Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public static class ByteUtil
The ByteUtil type exposes the following members.
名称 | 说明 | |
---|---|---|
![]() ![]() |
CeilingPowerOf2 |
返回大于或等于指定 Byte 的最小的 2 的幂次。 |
![]() ![]() |
CountBits |
计算指定 Byte 的二进制表示中 1 的个数。 |
![]() ![]() |
CountTrailingBits |
计算指定 Byte 的二进制表示中末尾连续 1 的个数。 |
![]() ![]() |
CountTrailingZeroBits |
计算指定 Byte 的二进制表示中末尾连续 0 的个数。 |
![]() ![]() |
IsPowerOf2 |
判断指定 Byte 是否是 2 的幂。 |
![]() ![]() |
LogBase10 |
计算指定正 Byte 以 10 为底的对数值,得到的结果是大于等于当前值的最小对数值。 |
![]() ![]() |
LogBase2 |
计算指定正 Byte 以 2 为底的对数值,得到的结果是大于等于当前值的最小对数值。 |
![]() ![]() |
NextBitPermutation | 返回指定 Byte 二进制表示的下一字典序排列。 |
![]() ![]() |
Parity | 计算指定 Byte 的偶校验位。 |
![]() ![]() |
ReverseBits | 将指定 Byte 的二进制位逆序。 |
位运算的算法来自于 Bit Twiddling Hacks。