Big End or Little End Ordering

Computer memory is a linear sequence of bits organized into a hierarchical structure of bytes and words. One system is the "Big End," where bits and bytes are numbered starting at the most significant bit (MSB, "left," or high end). Another system is the "Little End," where bits and bytes start at the least significant bit (LSB, "right, " or low end). The following figure illustrates the difference between the two conventions for the case of addressing bytes within words.

Byte Order Within Words: (a) Big End, (b) Little End

Data types stored as subcomponents (bytes stored in words) end up in different locations within corresponding words of the two conventions. The following figure illustrates the difference between the representation of several data types in the two conventions. Letters represent 8-bit character data, while numbers represent the 8-bit partial contribution to 32-bit integer data.

Character and Integer Data in Words: (a) Big End, (b) Little End

If you serially transfer bytes now from the Big End words to the Little End words (BE byte 0 to LE byte 0, BE byte 1 to LE byte 1, ...), the left half of the figure shows how the data ends up in the Little End words. Note that data of size one byte (characters in this case) is ordered correctly, but that integer data no longer correctly represents the original binary values. The right half of the figure shows that you need to swap bytes around the middle of the word to reconstitute the correct 32-bit integer values. After swapping bytes, the two preceding figures are identical.

Data Sent from Big to Little: (a) After Transfer, (b) After Byte Swaps

You can generalize the previous example to include floating-point data types and to include multiple-word data types. The following table summarizes the ordering nature of several common processors.

Ordering Nature of Processors

Processor Byte Order Bit Order
Intel 80486, Pentium Series Little Little
Compaq Alpha and VAX Little Little
Motorola® 680XX Big Little
IBM Mainframes Big Big

The important result is that portable, serial transport of 8-bit character data between most systems is possible with little or no knowledge about the ordering nature of each system.

For more information on big and little endian data and Visual Fortran unformatted data conversion capabilities, see Converting Unformatted Numeric Data.