Difference between revisions of "Endian"

From Custom Mario Kart
Jump to navigation Jump to search
(Byte Order Mark)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Endianess ==
+
== Endianness ==
 +
In computing, memory commonly stores binary data by splitting it into 8-bit units (bytes). When a data word uses multiple of these units, the order these bytes are stored in memory becomes important. The terms '''endian''' and '''endianness''' refer to how bytes of a data word are ordered within memory.
  
In computing, memory commonly stores binary data by splitting it into 8 bit units (bytes). When a data word uses multiple such units, the order of storing these bytes into memory becomes important. The terms '''endian''' and '''endianness''', refer to how bytes of a data word are ordered within memory.
+
Each byte of memory is associated with an index, called its ''address'', which indicates its position. Bytes of a single data word are generally stored in consecutive memory addresses (e.g. a 32-bit integer would need 4 locations). '''Big-endian''' systems are systems in which the ''most significant byte'' of the word is stored in the ''smallest address'' given and the least significant byte is stored in the largest. In contrast, '''little-endian''' systems are those in which the ''least significant byte'' is stored in the ''smallest address''. Say the data word was "0A 0B 0C 0D" (a set of 4 bytes) and memory addresses starting at ''a'' with offsets 0, 1, 2 and 3 are given. Then, in big-endian systems, byte 0A is placed in offset 0, 0B in 1, 0C in 2 and 0D in 3. In little-endian systems, the order is the reverse.
  
Each byte of memory is associated with an index, called its ''address'', which indicates its position. Bytes of a single data word (such as a 32 bit integer datatype) are generally stored in consecutive memory addresses (a 32 bit integer needs 4 such locations). '''Big-endian''' systems are systems in which the ''most significant byte'' of the word is stored in the ''smallest address'' given and the least significant byte is stored in the largest. In contrast, '''little endian''' systems are those in which the ''least significant byte'' is stored in the ''smallest address''. Say the data word was "0A 0B 0C 0D" (a set of 4 bytes) and memory addresses starting at ''a'' with offsets 0, 1, 2 and 3 are given. Then, in big endian systems, byte 0A is placed in offset 0, 0B in 1, 0C in 2 and 0D in 3. In little-endian systems, the order is the reverse of it.
+
The network byte order is big-endian. This means that nearly all internet protocols, including IP (also called TCP/IP), use big-endian byte order.
  
⇒ [http://en.wikipedia.org/wiki/Endianness more info at Wikipedia]
+
== <span id="bom">Byte Order Mark</span> ==
 
+
The '''Byte Order Mark''' (or '''BOM''') is the Unicode character U+FEFF. It is used to detect the byte order of files. In text files, it is placed as the very first character and in binary files as member of the file header. For big endian files, the first byte is 0xFE and the second 0xFF. For little endian files, the first byte is 0xFF followed by 0xFE.
<span id="bom"></span>
 
== Byte Order Mark ==
 
 
 
The '''Byte Order Mark''' (or '''BOM''') is the Unicode character U+FEFF. It is used to detect the byte order of files. In text files it is placed as very first character and in binary files as member of the file header.
 
 
 
For big endian files, the first byte is 0xFE and the second 0xFF. For little endian files the first byte is 0xFF followed by 0xFE. Btw, the network byte order is big endian.
 
  
 
== Nintendo Wii ==
 
== Nintendo Wii ==
 
+
The main processor (CPU) of the [[Wii]] is an ''IBM [[wikipedia:PowerPC|PowerPC]]'', which stores data using the big-endian format. On the other hand, the processors found in most PCs use little-endian. This means to view and edit Wii data (particularly numbers) on a PC, the byte order must be reversed. Many tools support this reversing.
The main processor (CPU) of [[Nintendo]] [[Wii]]<ref>Wikipedia: [http://en.wikipedia.org/wiki/Wii Nintendo Wii]</ref> is a ''IBM PowerPC''<ref>Wikipedia: [http://en.wikipedia.org/wiki/PowerPC CPU PowerPC]</ref>. The CPU itself is a big endian system. So by the Wii supported file formats store data as ''big endian''.
 
 
 
== Current PC ==
 
 
 
Many PC including Windows, Linux and modern Mac are based on Intel or AMD x86 CPUs. And these are little endian CPUs. This means, for viewing and editing data and especially numbers (integer or floating point) the byte order must be reversed. Many tools support this ''reversing''.
 
  
 
== References ==
 
== References ==
<references/>
+
[[wikipedia:Endianness|Endianness]] on Wikipedia
  
 
[[Category:Technical Information]]
 
[[Category:Technical Information]]

Latest revision as of 08:04, 22 November 2021

Endianness

In computing, memory commonly stores binary data by splitting it into 8-bit units (bytes). When a data word uses multiple of these units, the order these bytes are stored in memory becomes important. The terms endian and endianness refer to how bytes of a data word are ordered within memory.

Each byte of memory is associated with an index, called its address, which indicates its position. Bytes of a single data word are generally stored in consecutive memory addresses (e.g. a 32-bit integer would need 4 locations). Big-endian systems are systems in which the most significant byte of the word is stored in the smallest address given and the least significant byte is stored in the largest. In contrast, little-endian systems are those in which the least significant byte is stored in the smallest address. Say the data word was "0A 0B 0C 0D" (a set of 4 bytes) and memory addresses starting at a with offsets 0, 1, 2 and 3 are given. Then, in big-endian systems, byte 0A is placed in offset 0, 0B in 1, 0C in 2 and 0D in 3. In little-endian systems, the order is the reverse.

The network byte order is big-endian. This means that nearly all internet protocols, including IP (also called TCP/IP), use big-endian byte order.

Byte Order Mark

The Byte Order Mark (or BOM) is the Unicode character U+FEFF. It is used to detect the byte order of files. In text files, it is placed as the very first character and in binary files as member of the file header. For big endian files, the first byte is 0xFE and the second 0xFF. For little endian files, the first byte is 0xFF followed by 0xFE.

Nintendo Wii

The main processor (CPU) of the Wii is an IBM PowerPC, which stores data using the big-endian format. On the other hand, the processors found in most PCs use little-endian. This means to view and edit Wii data (particularly numbers) on a PC, the byte order must be reversed. Many tools support this reversing.

References

Endianness on Wikipedia