tags:

views:

853

answers:

7

Does the change of macs over to intel chips mean we're done with the bit twiddling on numbers in binary resources for cross platform data distributions? Is that the last of this problem or are there some other platforms I'm not aware of?

+2  A: 

This is certainly not the last of this problem, particularly if you are writing for embedded systems, including Pocket PCs, etc. MIPS, ARM, and other architectures support bi-endian architectures which can select their endian-ness on system start-up.

If you're writing code that depends on byte ordering, you need to care about endian-ness. Don't expect this "problem" to go away anytime soon.

Nick Monkman
A: 

Define PC, what do you consider a PC?

I am currently typing this from an Linux distribution that is running on an arm 9 processor, which can be set into different endianness, but the default is big endian. Little endian is used by Intel, AMD and Via (x86 compatible).

Endian-ness won't go away any time soon, anytime you transmit anything over the network you have to make sure that it is in the right endianness, since the endian specified by Internet Protocol is actually big endian.

See the Wikipedia article on Endianness for more information.

X-Istence
+1  A: 

You seem to forget the endianness transcends processor architectures. There are plenty of algorithms and protocols that demand a particular byte order. For example, I spent two weeks trying to get an MD5 hashing algorithm to work, only to realize that I had assumed network byte order (Big Endian) while Ronald Rivest had assumed (without stating so in the RFC) that the implementor would use Little Endian byte order.

Remind me to hurt that man sometime. :-P

64BitBob
+1  A: 

Pesky x86's dirtying up my memory registers with their segment pointers! ;)

I believe you don't need to flip words between PCs and Macs anymore, assuming you're eschewing backwards-compatibility with PowerPC.

Kevin Conner
+4  A: 

Well, actually there are plenty of big endian CPUs left over.

Actually the PPC is not dead. You are aware, that the Xbox360 uses PPC CPUs (and it is a good example, that these CPUs are not as bad as their reputation - the Xbox360 is anything but slow). Okay, this one may not count as a PC.

But does a server count as a PC? There are still plenty of servers using Sun's UltraSparc CPUs, that are generally big endian, though the latest models can be either big or little endian. There are many CPUs that can be either one or the other (e.g. ARM, still used in many devices like mobile phones and the like), as supporting both adds greatest flexibility for the hardware and for the software vendors. Even the IA64 CPUs (the Intanium, that was intended to replace x86 before AMD invented x86-64, that was true 64 bit and could only emulate 32 bit, unlike x86-64 that can be both) is one of the CPUs that can be switched to big endian. CPUs that can be both are called bi-endian.

Actually if you ignore Intel (and compatible CPUs) for a second, most CPUs on the market are either big endian or at least bi-endian, though most of these are not used in any consumer PCs as far as I know.

However, I see no endian problem as many programmers do. Every modern CPU can swap endian in hardware. Actually if you'd write a program on a little endian Intel CPU, that swaps endianess of every integer read from memory and again when writing back to memory, this will cause maybe a performance penalty as little as 5%; and in practice you only need to swap endianess for data coming in and going out of your application, as within your application the endianess is constant, of course.

Also note: Almost all network protocols I know specify byte order to be big endian, TCP/IP being the most familiar family. So if you work on lower network layers, you will always have to continue swapping bytes.

Mecki
I've never seen IA64 running in big-endian mode. It's not bi-endian, just a bit bi-curious.
Robert Fraser
A: 

I was thinking the same question: since Macs are now Intel, is the endian issue dead? Nope. Aside from certain supercomputers (which, let's face it, us lay-folk will never have to deal with) there is still one major area where big-endian order is used: network protocols, particularly: the Internet Protocol (as in: "IP" of TCP/IP).

Dinah
A: 

Now, more than ever, a person's main computer is less likely to be a deskop computer running a general purpose operating system. Although that is still quite common, many other folks are using smartphones or umpc devices that are purpose built, ie for browsing the web. These platforms do not neccesarily have x86 cpus. More often, especially with smartphone devices, they are using an ARM core, which is big endian.

TokenMacGuy