c++ - Bitshifting on little-endian and big-endian -
this question has answer here:
- bitwise operators , “endianness” 5 answers
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:
the value of 0x0a0b0c0d
still same.
Comments
Post a Comment