c++ - Bitshifting on little-endian and big-endian -


this question has answer here:

will this:

((0x10203040 >> 24) & 0xff) == 0x10 

always true on both little-endian , big-endian machines?

yes. endianness affects how bytes stored in memory. value of 0x10203040 270544960 regardless of whether it's first or last byte in memory 0x10.

to gratuitously borrow images wikipedia article on endianness, regardless of of these layouts our system uses:

enter image description hereenter image description here

the value of 0x0a0b0c0d still same.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -