[patch] Find if we are big endian at compile time

Chandler Carruth chandlerc at google.com
Thu Apr 11 17:35:57 PDT 2013


On Thu, Apr 11, 2013 at 4:53 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 11 April 2013 19:45, Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> wrote:
> >> It's worth noting that __BYTE_ORDER__ and friends are only available
> >> starting with GCC 4.6.
> >
> > gah, that kill the patch :-(
> >
> > On OS X gcc defines __LITTLE_ENDIAN__. Do you know if that is also
> > true of other platforms?
>
> I just checked on linux and it doesn't :-(
>
> We could ifdef on the processor defines, but that would probably get
> nasty. I will see what I can do without the ICE.
>

Err, on essentially any modern system, I think you can use <endian.h> (see
the endian(3) man page) to get BYTE_ORDER to be defined.

I would suggest using the preprocessor pattern outlined at the bottom of
this page: http://sourceforge.net/p/predef/wiki/Endianness/


>
> Thanks,
> Rafael
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130411/555dd034/attachment.html>


More information about the llvm-commits mailing list