<PackageReference Include="Microsoft.Bcl.Memory" Version="11.0.0" />

System.Numerics.BitOperations

static class BitOperations
public static int LeadingZeroCount(uint value)

Returns the number of leading zero bits in the specified value.

public static int LeadingZeroCount(ulong value)

Returns the number of leading zero bits in the specified value.

public static int Log2(uint value)

Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined.

public static int PopCount(uint value)

Returns the population count (number of bits set) of a mask.

public static int PopCount(ulong value)

Returns the population count (number of bits set) of a mask.

public static uint RotateLeft(uint value, int offset)

Rotates the specified value left by the specified number of bits.

public static ulong RotateLeft(ulong value, int offset)

Rotates the specified value left by the specified number of bits.

public static uint RotateRight(uint value, int offset)

Rotates the specified value right by the specified number of bits.

public static ulong RotateRight(ulong value, int offset)

Rotates the specified value right by the specified number of bits.

public static int TrailingZeroCount(uint value)

Count the number of trailing zero bits in an integer value.