Thread: Question about endians

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485

    Question about endians

    Hallo,

    I was wondering what is the advantage of the different endian systems? To me it looks like small end big endians would have the same advantages/disadvantages, while middle endians would just make things more complicated?

    From what I have found out hand held consoles tend to favor the little endia system, while bigger systems are big endians.

    But does it really make a difference how memory is stored?

    Thanks

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It is probably more of a coincidence (as in handheld systems prefer ARM or MIPS, bigger systems prefer X86) than anything else.

    In the old days, the benefit of a little endian system was that a 16-bit update (for example increment or decrement) could potentially be made by writing the low byte only, and skipping the high byte - assuming you have a 8-bit bus, that is. On a 16-bit bus, you could perhaps do a 32-bit update by only updating the low half too.

    These sort of benefits are no longer interesting, since these type of updates go to cache in 99.99% of all cases (and 100% of performance critical updates).

    So, it's just a choice made by the processor designers these days.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    And probably based only on historical reasons or backwards compatibility issues with code that makes specific use of endianness.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    Is the difference between the two something programmers have to think about, or is it all done by the compiler?

    How can I convert between small and big? Found a few code examples of how to do it, but now `mathematical formula`

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You will have to worry about endianness if you are programming low level data communications between different systems, for instance, where you don't know or expect endianness to be different among them (this is basically anything network related these days). Or using libraries that warn you about their lack of support for endianness.

    As for converting, information is all over the web.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Just to clarify, x86 uses little endian.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM