0

Just to make sure if I understand this correctly. Is this right that little endian processors read the memory addresses from highest to the lowest address and where as a big endian processors suppose to read them from lowest to the highest address?

The confusion came when I thought that is it true that little endian processors read the data itself in the reserve order and not just the memory or anyway both?

I have read enough about how the data is laid out in the memory and I just want to know how does the data is interpreted by both kinds of processors?

  • 6
    Back in the day when the MIPS company was making reduced-instruction-set computer chips, they were used by Silicon Graphics in big-endian mode and Digital Equipment in little-endian mode. Silicon Graphics and Sun Microsystems (on their SPARC chips) both used big-endian software. Rumor has it that the Sun engineers used to mock the Digital Equipment engineers by reversing the letters in MIPS, calling their products "SPIM"-based. But, the Sun marketing people told the engineers to stop, because they didn't want anybody to start reversing the letters in "SPARC". – O. Jones Jan 12 '14 at 23:03
  • @OllieJones what is so objectionable to "RAPSC" – ratchet freak Jan 13 '14 at 14:13
  • I wrote "reverse", not "reverse and then circularly permute!" :-) – O. Jones Jan 13 '14 at 19:03
7

"Is this right that little endian processors read the memory addresses from highest to the lowest address and where as a big endian processors suppose to read them from lowest to the highest address?"

No, that would just be an implementation detail of the memory chip, which would not make any difference for how you use the system.

In the little endian notation a multi-byte value is stored with the smallest components at the lowest address:

The number 0x12345678 stored at address 0x10:

+--+--+--+--+
|78|56|34|12|
+--+--+--+--+
 ^        ^
 |        |
 0x10     0x13

In the big endian notation a multi-byte value is stored with the largest components at the lowest address:

+--+--+--+--+
|12|34|56|78|
+--+--+--+--+
 ^        ^
 |        |
 0x10     0x13

Note that endianess doesn't only apply to how data is read natively by the system. A file format stores multi-byte values in either of those notations, and if you read a file with little-endian notation on a system that uses big-endian notation, you have to swap the bytes around when you put the multi-byte values together.

  • 1
    To expand on that, modern processors have quite wide data buses - 32 or 64 bits is common. So a processor can read all 4 bytes of a 32-bit integer from memory simultaneously. There is no "order" in which they are read. – Simon B Jan 13 '14 at 10:40
  • @SimonBarker: Good point. I adjusted the text somewhat, so that it descibes the notation in terms of storage, and doesn't imply that the data is read in a specific order. – Guffa Jan 13 '14 at 10:56

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.