Will this:
((0x10203040 >> 24) & 0xFF) == 0x10
always be TRUE on both little-endian and big-endian machines?
Will this:
((0x10203040 >> 24) & 0xFF) == 0x10
always be TRUE on both little-endian and big-endian machines?
Yes. Endianness only affects how bytes are stored in memory. The value of 0x10203040
is always 270544960
regardless of whether it's the first or last byte in memory that is the 0x10
.
To gratuitously borrow images from the Wikipedia article on Endianness, regardless of which of these layouts our system uses:
the value of 0x0A0B0C0D
is still the same.
will this:
((0x10203040 >> 24) & 0xFF) == 0x10
be always TRUE on both little-endian and big-endian machines?
Yes, it will provide the same result on both architectures. It's actually a mathematical operation, and MSB LSB orders will be handled under the hood of that particular CPU's microcode.