Suppose I have unsigned long long x = 0x0123456789ABCDEF
.
Which of the following is correct? (I can verify only the first one):
67 45 23 01 EF CD AB 89
.EF CD AB 89 67 45 23 01
.01 23 45 67 89 AB CD EF
.01 23 45 67 89 AB CD EF
.The IA-32 and x86-64 instruction set architectures use the little-endian format.
Endianness is a term that describes the order in which a sequence of bytes is stored in computer memory. Endianness can be either big or small, with the adjectives referring to which value is stored first.
Bit order usually follows the same endianness as the byte order for a given computer system. That is, in a big endian system the most significant bit is stored at the lowest bit address; in a little endian system, the least significant bit is stored at the lowest bit address.
The following platforms are considered little endian: AXP/VMS, Digital UNIX, Intel ABI, OS/2, VAX/VMS, and Windows. On big endian platforms, the value 1 is stored in binary and is represented here in hexadecimal notation.
The first one is wrong. On ia32 at least the layout is EF CD AB 89 67 45 23 01
.
The others are correct.
Little endian means the least-significant bits are in the first byte, and big endian means the least-significant bits are in the last byte:
0x0123456789ABCDEF big endian is 0x01, 0x23, 0x45 ...
0x0123456789ABCDEF little endian is 0xEF, 0xCD, 0xAB ...
The native word endianess and size of the processor is inconsequential; the appearance in memory is dictated by the endian.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With