Endian/__BYTE_ORDER question

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Feb 12 03:52:36 EST 2010

Andreas Schwab <schwab at linux-m68k.org> wrote on 2010/02/11 17:35:54:
> Joakim Tjernlund <joakim.tjernlund at transmode.se> writes:
> > 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
> Only outside of __KERNEL__.

Ah, yes now I see. This is unfortunate as if one moves kernel
code to user space and still use the kernel way:
one will be in big trouble as including stdlib.h will define
both __LITTLE_ENDIAN and __BIG_ENDIAN. Spent quite a while
chasing that one down :(


More information about the Linuxppc-dev mailing list