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

Chandler Carruth chandlerc at google.com
Sun Apr 14 02:50:11 PDT 2013


I wonder if the MIPS folks would prefer to use their predefined
architecture macros. I wonder the same about the ARM folks.

Either way, I would make the behavior that we test for evidence of a big
endian system, and unless we find it, default to little endian. I think
this will neatly avoid the need to special case MSVC. It also seems prudent
given the last decade or so of hardware development. ;]


On Sat, Apr 13, 2013 at 9:01 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > 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 for the tip. New versions of the patches are attached.
>
> Thanks,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130414/c6841356/attachment.html>


More information about the llvm-commits mailing list