Method BitList
BitList(Byte)
Return the list of bits which are set in b
encoded as followed:
(i >>> (4 * n)) & 0x0F
is the offset of the n-th set bit of
the given byte plus one, or 0 if there are n or less bits set in the given byte. For example
bitList(12)
returns 0x43:
is 3, meaning the the first bit set is at offset 3-1 = 2,0x43 & 0x0F
is 4, meaning there is a second bit set at offset 4-1=3,(0x43 >>> 4) & 0x0F
is 0, meaning there is no more bit set in this byte.(0x43 >>> 8) & 0x0F
Declaration
public static int BitList(byte b)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | b |
Returns
Type | Description |
---|---|
System.Int32 |