Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
I am having trouble changing the endian of a variable.
First, I have two bytes that I want to combine to form a short. I have been able to do this by:
s = (b1 * 256) + b2;
Now, I want to swap all of the bits so that "s" that initially equals:
1100000000000010
becomes
0100000000000011
I would like to do it "simpler" than a line of code per bit if possible....