#1,082 – Big-endian and Little-endian

The terms “big-endian” and “little-endian” refer to the scheme that a computer uses to store binary data in memory.  The basic difference is:

  • Big-endian (e.g. IBM mainframes, Motorola 68000) – leftmost byte is stored first, followed by other bytes, left-right.  (“Big end” of number stored first)
  • Little-endian (e.g. Intel processors) – rightmost byte is stored first, followed by other bytes, right-left.  (“Little end” of number stored first)

Below is an example.  Assume that have a 4-byte (32-bit) number with a value of 0x1234ABCD (hex).  The diagram below shows how this number would be stored in a 4-byte chunk of memory, based on whether the processor uses the big-endian or the little-endian convention.

1082-001

 

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

3 Responses to #1,082 – Big-endian and Little-endian

  1. James Curran says:

    I wrote an article on the subject of Big Endian & Little endian some time ago:

    http://noveltheory.com/TechPapers/TechFrame.html#endian

  2. Pingback: #1,083 – Using Visual Studio to Verify Little-Endianness | 2,000 Things You Should Know About C#

  3. Pingback: #1,090 – Using Visual Studio to Verify How Floating Point Numbers Are Stored | 2,000 Things You Should Know About C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: