Big Endian is still supported natively on POWER8/9 Intel added movBE (mov big endian) support in BM2 extension. Networks are still Big Endian. SPARC chips (and now RISC-V) are BIG Endian by default. MIPS just became an independent company a few days ago and they have native Big Endian support. Edit 1: I was wrong about Power8/9 LE/BE
If you use Linux on POWER you're forced to use Big Endian mode as the faster Little Endian mode (according to marketting) is reserved for IBM's operating systems. That's not correct. Ubuntu is LE only and it looks like RHEL is also switching from BE to LE. "The base RISC-V ISA has a little-endian memory system, but non-standard variants can provide a big-endian..." SPARC and MIPS are dead.
Ask HN: Is big-endian dead?
41–50 of 193 posts
Re: Ask HN: Is big-endian dead?
#42Earlier quoted context omitted.
Actually, Silverthorne (the first Atom CPU) added MOVBE.
It seems that Atom has become - ironically - a staging ground for new features that make their way much later to the desktop/mobile x86_64 architecture. Here's another: https://neosmart.net/blog/2017/will-amds-ryzen-finally-bring...
Re: Ask HN: Is big-endian dead?
#43> Little-endian is slightly more confusing for humans... I think you meant to write “Little-endian is slightly more confusing for humans who use left-to-right languages ” as all the R-L languages also put the least significant digit on the right.
Not true. In arabic languages you write text R-L, but numbers are L-R.
Re: Ask HN: Is big-endian dead?
#44Re: Ask HN: Is big-endian dead?
#45Earlier quoted context omitted.
Not true. In arabic languages you write text R-L, but numbers are L-R.
Do you mean that you read a text from the right to the left, and when you meet a number you jump to is leftmost digit, then read it LR, then jump agzin to its left (where there is a space) and resume reading text?
Re: Ask HN: Is big-endian dead?
#46However, when the number's range is small enough, such code appears to work. Finding the bug is delayed until larger values occur, which is not until its deployed in the field or someone thinks of writing better test cases.
Anyway, if it is okay to truncate, the right thing to do (and ISO C conforming) is to access the underlying type as that type, and then cast the result, not to cast the pointer. I.e. rather than:
int x = *(int *) ptr64; // breaks on BE; not kosher with ISO C aliasing rules
this: int x = (int) *ptr64; // works on LE and BE
We don't even need the casting operator in the second example. So it's less syntax and clearer code to do the more portable thing.If we want the bits for that int from some other part of the wider word, we can use shifting and masking.
Re: Ask HN: Is big-endian dead?
#47Little endian is also better for multi-word addition/subtraction. Your first operand will be the low word, which your pointer conveniently already indexes. This was a classic trick in the days of 8 and 16 bit systems, and assembly code for modern modular crypto systems still uses it. Really I think consensus is that the industry focus on big endian systems was actually a mistake. It prioritized programmer comfort in…
Re: Ask HN: Is big-endian dead?
#48I used to use IETF's network order (big-endian) for everything on disk or over the wire, but I switched to little-endian around 2008. If I ever have to port to a big-endian machine I'll deal with it then. I haven't regretted it yet.
Big-endian is the canonical form for storage and the wire because back when the Internet was designed most "pro" machines were big-endian: Sparc, old MIPS, old PPC, DEC Alpha, etc. All these are dead or dying now. It's easy enough to deal with BE files and protocols by just swapping bytes. I'm referring to hardware architectures. Are there still any big-endian chips out there? Does it still make sense to support big-…
Hands down no brainer.
Even the fact that headers come before payloads is a kind of "big endian", as is the fact that important information tends to occur earlier in headers. Look at a basic Ethernet frame. The destination address is first, so before even knowing the source address, or anything else, the switch can know where that frame will be sent.
Re: Ask HN: Is big-endian dead?
#49Earlier quoted context omitted.
Arabic numbers are L-R if you have a big-endian mindset, but R-L if you switch to a little-endian mindset :)
No. Arabic numbers are always L-R...
Re: Ask HN: Is big-endian dead?
#50Little-endian is slightly more confusing for humans I've heard this before, but the reason is that you view hex data and list numbers left-to-right as if they were letters. They are not. 0x12345678 stored big-endian, numbering bytes left-to-right: 12 34 56 78 Looks good, but I think that this is actually more confusing, because when you number the bytes and bits you will see that the bytes are written left-to-right,…
The endianness at the bit level is irrelevant because the bits are chunked into bytes, and are usually not even addressable.
A storage format exhibits endianness only when it is addressable.
In the C language, bits are only "addressable" via the shift operators. These are rooted in pure arithmetic, so that 1The only time you deal with "bit endianness" is with certain compressed data formats, and with bitfield layout rules.