Endianess: Difference between revisions

From Rice Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
In '''Little Endian''', the least significant byte is stored at the lowest part of an address (i.e. little end first). Addresses would look something like 0x40, 0x30, 0x20, 0x10. LE is used on intel machines.
In '''Little Endian''', the least significant byte is stored at the lowest part of an address (i.e. little end first). Addresses would look something like 0x40, 0x30, 0x20, 0x10. LE is used on intel machines.


Most file formats specify endianess. For example, a Unicode text file has a BOM (byte order mark) at the start to denote whether the file is BE or LE.
Besides different CPUs using different endianess to run instructions, most file formats specify endianess to support different machines. For example, a Unicode text file has a BOM (byte order mark) at the start to denote whether the file is BE or LE.
 
= Arguments =
Modern processors can operate in either mode.
 
[[Category:Computer Architecture]]
[[Category:Computer Architecture]]

Latest revision as of 15:21, 22 May 2024

CPUs operate on a group of bits called a word. A 32-bit CPU has a 32 bit (4 byte) word size. Endianess is the choice of order when storing multiple bytes of a word across memory. There are two choices: Big Endian and Little Endian.

Consider storing 0x10203040 in a 32-bit machine

In Big Endian, the most significant byte is stored at the lowest part of an address (i.e. big end first). Addresses would look something like 0x10, 0x20, 0x30, 0x40. BE is used on the internet.

In Little Endian, the least significant byte is stored at the lowest part of an address (i.e. little end first). Addresses would look something like 0x40, 0x30, 0x20, 0x10. LE is used on intel machines.

Besides different CPUs using different endianess to run instructions, most file formats specify endianess to support different machines. For example, a Unicode text file has a BOM (byte order mark) at the start to denote whether the file is BE or LE.

Arguments

Modern processors can operate in either mode.