x.z = x.z << 8; //bit shift x.z 8 bits left then store that new bit pattern in x.z
@ne555: Right. So then, what would this print out, if stored in big-endian format? What could I change in my code to mimic that behavior even though I am instead storing in little-endian format?
If you set it to "ABC" then it will be stored. 'A''B''C''\0'
Little endian reads from right to left (3258), big endian left to right (43968).
So if you multiply by 2^8 ("left" shift)
1 2
'\0''A''B''C' // little endian 52128
'B''C''\0''\0' // big endian 48128
So in different systems they are different numbers, so you can't use bit-shift (arithmetic operation) and expect the same result.