Hello, I'm new to C and am having trouble with bit shifting. I am working on an app that takes 10 bit RGB pixel values (packed into 32 bit words) and shifts them by two bits. I can get this to work (values are properly shifted) if I use the following code:
temp = swap_e(temp);
temp = (temp<<2);
temp = swap_e(temp);
swap_e() is a function that simply swaps the endian order. Example:
b3420a23 //before swap_e()
230a42b3 //after swap_e()
However, I've read in more than one place that endianness shouldn't affect bit shifting. Why would this work if I swap the endian order before performing the bit shift? I aplogize if this is a really rudimentary question, but I'm still learning! Thanks in advance!