Endianness

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Tue Jan 12 21:47:28 UTC 2010


Kaya Saman <SamanKaya at netscape.net> writes:

> David Kelly wrote:
>> On Tue, Jan 12, 2010 at 12:51:00PM -0800, Rob Farmer wrote:
>>   
>>> I'm trying to create a port of an application which only works on
>>> little endian systems and I'm trying to figure out how to set
>>> ONLY_FOR_ARCHS.  Wikipedia says PowerPC, Sparc, and IA64 are bi-endian
>>> and the OS chooses the mode. I'm not familiar with these platforms -
>>> I'm sure it has been answered somewhere, but I can't find it - which
>>> FreeBSD archs are little/big endian? Thanks.
>>>     
>>
>> i386 is little endian. Would expect ia64 to be the same.
>>
>>   
>
> SPARC is big endian. Or at least it used to be.....
>
> Power4,5,6 are all big endian too if I'm not mistaken.
>
> Correct me if I'm wrong but anything based around the CISC
> architecture is big endian.

As the original poster observed, PowerPC, Sparc and IA64 are all capable
of being used in either endian setting.  

I checked endian.h, and it looks as though FreeBSD uses Sparc as
big-endian, IA64 as little-endian, and PowerPC as whatever it picks up
from gcc (probably big-endian, since the architecture does funny things
with alignment in little-endian mode.

My best advice, though, is to suggest that Mr. Farmer shouldn't assume
that the application will work anywhere without actually trying it.

-- 
Lowell Gilbert, embedded/networking software engineer, Boston area
		http://be-well.ilk.org/~lowell/


More information about the freebsd-questions mailing list