How to extract specific bits from a number in C?
I need to extract specific part (no of bits) of a short data type in C. For Example I have a binary of 52504 as 11001101000 11000 and I want First 6 ( FROM LSB --> MSB i.e 011000 decimal 24) bits and rest of 10 bits ( 11001101000 decimal 820). Similarly I want this function to be too generalized to extract specific no of bits given "start" and "end" (i.e chunks of bits equivalent with some decimal value). I checked other posts, but those were not helpful, as given functions are not too much generalized. I need something that can work for short data type of C. Edit I am having the short array