Big Or Little Endian?


rickreynolds

Still Fresh
Joined
Jan 16, 2006
Messages
7
I'm working on a port of an emulator. This emulator has already been ported to several platforms, including Linux. I get a build, but it always complains about the game roms.

I'm wondering if I'm fighting an endianness problem. What is the endian-nature of the GP2X? I couldn't find a definitive answer anywhere.

Thanks much,
Rick
 
In decimal, if you want to write a number bigger than 9, you tend to write "10", but you could write "01" equally well and do everything backwards. It's an arbitrary decision. The same thing happens with computers - given that memory is addressed as an array of bytes, which can store values from 0 to 255, if you want to store 256 you need to use two bytes. You can either store "1" in the low byte and "0" in the high byte, known as big-endian, or you can store them the other way around, known as little-endian. In big-endian, the big end comes first.

The majority of microcomputers use little-endian, including the GP2X and all Intel x86 compatible machines.
 
It means that the gp2x, (and x86) store 1234 as 4 3 2 1. This is little endian or Least-Significant Byte First. Others such as sparc and power store it as 1 2 3 4, big endian, or most significant byte first.

It doesn't really matter as long as they live in their own little worlds. The problem comes when you save data on one and try and load it on another, some conversion has to take place somewhere.

But, from a user's perspective, you shouldn't be able to notice any difference.

ps. http://en.wikipedia.org/wiki/Endian

edit: gfoot, you're just too damn fast for me. insert more coffee to continue.
 
Back
Top