Endian/__BYTE_ORDER question

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Feb 12 03:17:37 EST 2010


I am getting confused about on how to test for Endian in the kernel code. In user
space one uses #if __BYTE_ORDER == __LITTLE_ENDIAN or #if __BYTE_ORDER == __BIG_ENDIAN

I can see lots of kernel headers using this test too, but it doesn't seem
to be an arch specific file #defining __BYTE_ORDER. Instead I find files like:
 arch/alpha/math-emu/sfp-util.h
 arch/powerpc/include/asm/sfp-machine.h
 arch/s390/include/asm/sfp-util.h
 arch/sh/math-emu/sfp-util.h

How is this supposed to work?

    Jocke



More information about the Linuxppc-dev mailing list