Difference between revisions of "Endian"

From Custom Mario Kart
Jump to navigation Jump to search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
== Endianness ==
 
== Endianness ==
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 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 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 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.
+
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.
 
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.
  
<span id="bom"></span>
+
== <span id="bom">Byte Order Mark</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 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.
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 ==
 
== Nintendo Wii ==
The main processor (CPU) of the [[Wii]]<ref>Wikipedia: [[wikipedia:Wii|Nintendo Wii]]</ref> is an ''IBM PowerPC''<ref>Wikipedia: [[wikipedia:PowerPC|CPU PowerPC]</ref>, 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 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.
  
 
== References ==
 
== References ==
<references/>
+
[[wikipedia:Endianness|Endianness]] on Wikipedia
 
 
== External links ==
 
[[wikipedia:Endianness|Wikipedia article on endianness]]
 
  
 
[[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