Adrian Reber <adr...@lisas.de> wrote on 2010/02/11 17:33:29: > > On Thu, Feb 11, 2010 at 05:17:37PM +0100, Joakim Tjernlund wrote: > > 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? > > I have no idea how it is actually done in the kernel code... but gcc > defines it: > > gcc -dM -E -x c - <<<'' | grep ENDIAN > #define __BIG_ENDIAN__ 1 > #define _BIG_ENDIAN 1
That doesn't define __BYTE_ORDER. Try the same gcc command on a file that #includes <stdlib.h> and you will get both __BIG_ENDIAN and __LITTLE_ENDIAN Jocke _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev