>>>>> On Thu, 16 Oct 2008, Dan Nicolaescu wrote: > On all the machines that I am aware off that support both big and > little endian the compiler predefines a symbol to distinguish > between them. It turns out that gcc defines __LITTLE_ENDIAN__ and __BIG_ENDIAN__, respectively: $ echo | sh4-gentoo-linux-uclibc-gcc -nostdinc -dM -E - | grep ENDIAN __LITTLE_ENDIAN__ (To add some confusion, endian.h then also defines _all_ four of __LITTLE_ENDIAN, LITTLE_ENDIAN, __BIG_ENDIAN, and BIG_ENDIAN, regardless of the machine's byte sex. Go figure.) > I'll install this when the endianess issue gets resolved. I still think that my previous approach (include sys/param.h and test for __BYTE_ORDER) was cleaner. But if you absolutely want a compiler-defined symbol, an updated patch is included below. Ulrich