Endianness: Difference between revisions

From wikinotes
Line 22: Line 22:
= Terminology =
= Terminology =
<blockquote>
<blockquote>
'''background:'''
If a large integer is stored in memory, it will require multiple bytes (8-bits).<br>
If a large integer is stored in memory, it will require multiple bytes (8-bits).<br>
For example, the number 4095 requires 12 bits.<br>
For example, the number 4095 requires 12 bits.<br>
Line 27: Line 28:
If described in 2x 8-bit bytes, this would be <code>00001111 11111111</code>.
If described in 2x 8-bit bytes, this would be <code>00001111 11111111</code>.


'''terminology'''
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
most significant byte: |
most significant byte: |

Revision as of 00:34, 3 August 2021

Endianness describes the order bytes are stored in memory in a multi-byte piece of data.

For example, the 2-byte(16-bit) integer 27591 is stored differently in big endian(BE) and little endian(LE).

# left-to-right
BE: 01101011 11000111  # 0110101111000111

# right-to-left
LE: 11000111 01101011  # 0110101111000111

Documentation

wikipedia https://en.wikipedia.org/wiki/Endianness

Terminology

background: If a large integer is stored in memory, it will require multiple bytes (8-bits).
For example, the number 4095 requires 12 bits.
In binary this would be 0000111111111111.
If described in 2x 8-bit bytes, this would be 00001111 11111111.

terminology

most significant byte: |
    byte containing the highest chunk of the number. 
    ex: 9876..... in 987654321

least significant byte: |
    byte containing the lowest chunk of the number.
    ex: ....54321 in 987654321