/// <summary> /// Retrieves the integer value of first six bits in a byte /// </summary> /// <param name="b"></param> /// <returns></returns> public int GetFirstSix(byte b) { for (int i = 0; i < 6; i++) { sixbits[i] = BitOps.GetBit(b, i); } return(BitOps.GetIntegerValue(sixbits)); }
/// <summary> /// Retrieves the last two bits from a single byte (8 bits) /// </summary> /// <param name="b"></param> /// <returns></returns> public int GetLastTwo(byte b) { byte c = 0; for (int i = 7; i > 5; i--) { twobits[c] = BitOps.GetBit(b, i); c++; } return(BitOps.GetIntegerValue(twobits)); }