I\'m having a little trouble grabbing n bits from a byte.
I have an unsigned integer. Let\'s say our number in hex is 0x2A, which is 42 in decimal. In binary it looks li
just get rid of the 8* in your code.
int input = 42; int high3 = input >> 5; int low5 = input & (32 - 1); // 32 = 2^5 bool isBit3On = input & 4; // 4 = 2^(3-1)