News Focus
News Focus
icon url

CombJelly

08/17/04 8:19 AM

#42415 RE: Golfbum #42413

"isn't the sparc codebase big endian?"

Yep. But endian-ness is usually only a factor when you are moving data between systems with a different orientation. Given that this is already a problem for Sun, I suspect there are tools for dealing with this situation...
icon url

sgolds

08/17/04 9:43 AM

#42418 RE: Golfbum #42413

Golfbum, most big/little endian issues will resolve with a recompile. The exceptions are areas where the programmer made shortcut assumptions. For instance, if he writes a long into an array and then accesses the big-endian low byte of that long by taking the address of the array entry and adding 3 then he would get the wrong byte even after a recompile. This is considered abusive programming practice, most programmers will get the long and then cast it as char to get the correct byte.

Let's see, if I remember my C syntax:

char byte_data = *(&array->long_data + 3) /* vs. */
char byte_data = char(array->long_data)

As you can see, it takes a little work to do it incorrectly!

Such examples are very rare. Assembler portions of drivers would be the most likely abusers.