Could anyone tell me as to how to extract \'n\' specific bits from a 32-bit unsigned integer in C.
For example, say I want the first 17 bits of the 32-bit value;
If you need the X last bits of your integer, use a binary mask :
unsigned last8bitsvalue=(32 bit integer) & 0xFF unsigned last16bitsvalue=(32 bit integer) & 0xFFFF