The library provides bit operations for c#.
The methods below exist for ulong
, uint
, ushort
, byte
types:
int GetFirstSetBit(n)
- Returns the index of the first set bit in the binary n representation or -1 if it's missing.int GetLastSetBit(n)
- Returns the index of the las set bit in the binary n representation or -1 if it's missing.