Is there any elegant and shortest way how to do it?
unsigned char someInteger(int someInt) {
// 00110110
unsigned char type[7];
type[7] = ((someInt >> 7) & 0x1);
type[6] = ((someInt >> 6) & 0x1);
type[5] = ((someInt >> 5) & 0x1);
type[4] = ((someInt >> 4) & 0x1);
type[3] = 0;
type[2] = 0;
type[1] = 0;
type[0] = 0;
return type; // 48
}
I'd like to have just 4th to 7th bit of the number.
Thanks a lot!