Why won't big endian die?

Discussion in 'Web development / Programming' started by cottonvibes, Dec 12, 2010.

  1. cottonvibes

    cottonvibes You're already dead... Emu Author

    Messages:
    5,473
    Likes Received:
    4
    I'm puzzled on why there are still big endian machines out there, and why architectures don't do the sane thing and use little-endian always.
    Is there any real reason for this aside from purposely making code portability and optimization harder?

    Big endian is unintuitive and stupid; its one of the things i hate about the ps3.
    (btw i'm bored so that's why i started the topic)
  2. NGEmu.com Advertisement

  3. @ruantec

    @ruantec Crazy GFX coder Emu Author

    Messages:
    10,358
    Likes Received:
    192
    you must be very bored...

    Many mainframe computers, particularly IBM mainframes, use a big-endian architecture and until they do not change that "big-endian" will survive.
  4. tykel

    tykel Sober coder

    Messages:
    453
    Likes Received:
    0
    Well, big-endian machines arguably make values in memory human readable... Not that it's a reason for it to stick around, though.
    I'm guessing they are still around for compatibility reasons, as @ruantec mentioned.

    On a similar note, why won't BIOS die and EFI replace it?
  5. bram64

    bram64 Member

    Messages:
    79
    Likes Received:
    0
    You could also be wondering why little endian won't die. I guess the best real life analogy of endianness is blood type. There is no clear advantage to having a certain blood type, but it sure would be convenient if we all just had the same blood type.
  6. cottonvibes

    cottonvibes You're already dead... Emu Author

    Messages:
    5,473
    Likes Received:
    4
    there are advantages to little endian though.
    Endianness #Optimization - Wikipedia
    Why Big-Endianness is Wrong

    for a programmer its easier to think in little endian, and it allows better optimization.
    in general i believe most experienced people prefer little endian; we should just kill big endian and end the confusion.

    yeah i was :p

    yeah but whats the reason for making new consoles like the wii and ps3 use big endian architectures.
    Last edited: Dec 12, 2010
  7. @ruantec

    @ruantec Crazy GFX coder Emu Author

    Messages:
    10,358
    Likes Received:
    192
    I may be wrong but as a ex-graphics designer myself i know by experience that a lot of people work with Macs in the design area and while they are little-endian based pc's now days they were not back in the days and since a lot of games designers work with macs still i guess its sort of standard to use that architecture. another reason may be the big influence IBM has in the market still which may lead console-makers to make such decisions to use there structure which as mentioned is mainly big-endian.

    still when you look at the Wii and the PS3 the architecture is not the biggest problem like in the case of the PS3 where there are other barriers that need to be broken because of the way the machine was designed and the insane amount of encryption that makes the life of any coder a hell... but am sure you know what am talking about ;)
    Last edited: Dec 12, 2010
  8. runawayprisoner

    runawayprisoner Level 9998

    Messages:
    9,384
    Likes Received:
    0
    Because EFI is more work to do. Many mainstream consumer-level OSes (Windows) don't support booting from EFI as far as I know (but their server versions do), so to boot those OSes, you're gonna have to do some extensive work on your EFI, which is not really a good way to do it considering BIOS still works and BIOS takes much less work to make.

    As far I can recall, Apple is still the only company to have implemented EFI in a consumer-level product.

    Correcto. But to be more precise, since the contents were created in big-endian machines, might well make big-endian consoles. :p

    Nope. What are you talking about? :p

    The Wii has been hacked to hell and back, and the PS3 apart from firmware 3.55 can be downgraded back as you please. Let's just say security and encryption means squash.

    The biggest concern of the PS3 architecture as far as I can see is that the main CPU is not that fast, and the other cores that are not proper CPUs are fast but not that useful. It's like an emulation nightmare, both for emulating the device and for the device to emulate something else.
  9. bram64

    bram64 Member

    Messages:
    79
    Likes Received:
    0
    I'm willing to bet there exist similar tricks that are exclusive to big endian too. Even if there aren't, the overall advantage is fairly minor. Besides, it makes sense to keep the order of the bits and extend that order to the way we arrange the bytes.

    But in the end, it doesn't really matter. The good news is that PowerPC can apparently switch endianness.
  10. Exophase

    Exophase Emu author Emu Author

    Messages:
    1,478
    Likes Received:
    1
    Little endian has only that one practical advantage, and that little trick may well never be a useful optimization on the RISC platforms employing big endian. I know on ARM you actually want to avoid byte loads over words loads if you can help it because for the past several generations it's had an extra cycle of load-use latency.

    The only reason I'd ever use that optimization on say, x86 (which, since we're making architecture calls based on low level optimizations maybe we should just throw it out altogether since it has all sorts of bad design facets) is for memory-immediate operations where the byte version is smaller or for getting a little more register space out of using the byte segments. But that's for cases where it's actually valid and meanginful to only look at the bottom 8-bits of a 32-bit value, which is going to be pretty rare.

    Doing this sort of thing in higher level code (that's still not so high level as to prevent this) is a bad idea because it's bound to introduce aliasing problems. I've actually had code fail on higher optimization levels over things like this.

    Big endian makes sense to people because we write most things in ascending order; almost any hex editor will display things this way and will make big endian numbers more directly legible. But it's a pretty minor difference. IP actually defines network byte order as big endian, so for archs going in switches and other network devices being big endian can be a benefit.

    So yeah, calling it stupid and unintuitive over one obscure advantage and otherwise arbitrary preference is a bit overblown..

    On the other hand, it's nice for platforms you're emulating to be the same endianness as what you're emulating on.
  11. cottonvibes

    cottonvibes You're already dead... Emu Author

    Messages:
    5,473
    Likes Received:
    4
    If there were useful tricks then i wouldn't complain.
    The trick i know of that you can do with it is almost never useful.
    Basically you can use the lower bytes as an approximization for how big the number is, because it contains the most significant bits of the byte.

    i disagree. even if you disregard the optimization tricks it lets you perform, it messes up the way you think about memory.
    read the second link i posted.


    it does matter, especially if you want your code to be cross platform.
    it really ****s up some code in c/c++ and makes you have to bloat your code having seperate big endian/little endian implementations.

    and if you do communication between different architectures you have to know the endianess of the transfers.
    if everything used just one endianess then we wouldn't have this problem.

    the reason we still have this problem today is because people have the attitude "it doesn't matter".
    standards are important in computing, it makes things so much easier for others when they can expect systems to act a certain way because it follows the norm.

    guess thats good.

    it would be nice if we had standards that computers followed instead of swapping it around for different architectures.
    Last edited: Dec 14, 2010
  12. Kaizen

    Kaizen Qu'ils mangent de la brioche Award Winner!

    Messages:
    6,329
    Likes Received:
    89
    big endian

    There's a double entendre there...
  13. blueshogun96

    blueshogun96 Last Xbox Emu Author Staff Member Moderator Emu Author

    Messages:
    5,935
    Likes Received:
    18
    I agree with cotton. I prefer that the whole world goes little endian. It may be tricky for n00b programmers to grasp and remember at first, but they pay off is worth it. After dealing with x86 for so long, I can't ever imagine dealing with big endian without going crazy.

    All current gen consoles use big endian. I can't speak for Sony and Nintendo, but Microsoft cares more about security then ease of portability, speed and user experience (as proven with Xbox1, even though that console was better than it's successor).
  14. Bill_gates

    Bill_gates Linux's worst nightmare..

    Messages:
    1,510
    Likes Received:
    0
    buttttttttttt its soooooooooo eZZZZ to read
    is the usual excuse
  15. masta.g.86

    masta.g.86 No sir, I don't like it. Award Winner!

    Messages:
    5,282
    Likes Received:
    0
    The reason why it won't die is simple:

    Databases created on big endian systems can only be read by big endian systems. While conversion programs exist to some extent, they are iffy at best. It's just easier for large businesses and corporations to remain locked into big endian.
  16. blueshogun96

    blueshogun96 Last Xbox Emu Author Staff Member Moderator Emu Author

    Messages:
    5,935
    Likes Received:
    18
    ^ yeah, that would be the biggest excuse to keep it.

    I still think game consoles are better off using little endian out-of-order execution style CPUs. From what I've read, little endian is more efficient than big endian. That's yet another advantage Xbox1 had over 360.
  17. Exophase

    Exophase Emu author Emu Author

    Messages:
    1,478
    Likes Received:
    1
    I dunno shogun, talking about XBox being superior to XBox 360 because its CPU is out of order and its byte order is little endian is pretty bizarre. It kinda sounds like you'll attribute any difference between the two as a pro for the original because you like the original more.

    I know there were arguments in this thread about little endian being more efficient but they're almost totally bunk and you all know it. The real reason anyone favors it, or big endian, is because of familiarity and because they think a tiny bit more compatibility with their favorite processors is more important than a tiny bit more compatibility with the processors they don't care about.

    In reality, most processors these days are dual endian. But not x86 ones. So if anything it's x86 doing it wrong.
  18. blueshogun96

    blueshogun96 Last Xbox Emu Author Staff Member Moderator Emu Author

    Messages:
    5,935
    Likes Received:
    18
    Honestly, I wasn't trying to imply that Xbox1 is superior to the 360 CPU wise, I was merely stating two advantages it had, even though the 360 has a greater advantage with security (the Xbox1 CPU rolls over from 0xFFFFFFFF to 0x00000000 if the jump command is not executed at the top of ROM while 360 does not have that weakness). And yes, I do like the original more.

    Since you are the more experienced one, I'm going to take your word for it. I'm just going by the things I read.

Share This Page