[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: calling all ports: what is your endianness?



On Mon, Jan 21, 2002 at 07:22:48PM -0500, Steve M. Robbins wrote:
> Hi,
> 
> I just uploaded new Boost (www.boost.org) C++ libraries to sid, and
> discovered that they have this buried inside the headers:
> 
> 
> #if defined(__sparc) || defined(__sparc__) || defined(__powerpc__) || defined(__ppc__) || defined(__hppa) || defined(_MIPSEB)
> #define BOOST_BIG_ENDIAN
> #elif defined(__i386__)
> #define BOOST_LITTLE_ENDIAN
> #else
> #error The file boost/detail/limits.hpp needs to be set up for your CPU type.
> #endif
> 
> 
> This has already tripped up the alpha autobuilder.  
> 
> If your favourite architecture is NOT listed in the above, could you
> please send me:
> 
>   1. a preprocessor symbol to test for, and
>   2. the correct endianness.

Use <endian.h>.  It is available on all glibc targets.
Then use: 
#if __BYTE_ORDER == __BIG_ENDIAN

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



Reply to: