Actually I suspect that there is really only one way to do this task - whatever the actual macro variable names used in the code.
Probably.. FYI.. I worked up an initial implementation in the Predef library over the weekend from the information I could find on-line. Which I suspect is less than what the current endian header has. I'll check it in tonight and ask for feedback as to what's missing and style.
First pass at the Predef header for this at < https://raw.github.com/grafikrobot/boost-predef/master/include/boost/predef/endian.h>. Currently only tested on my OSX laptop. Would appreciate others trying it out. The info is a combination of the indispensable description from predef.sf.net (Bjorn Reese et al), known endian specifications I could find on the architectures I currently detect, and a small amount of general web searching.
I haven't looked at your version yet, but here's the start of the
reverse-engineering info:
Output:
~~~~~
* Define BOOST_LITTLE_ENDIAN when little endian.
* Define BOOST_BIG_ENDIAN when big endian.
* Define BOOST_PDP_ENDIAN when PDB endian.
* Emit a #error when endianness can't be possitively determined.
*Define BOOST_BYTE_ORDER to either 1234 (LE) or 4321 (BE).
Post SGI version modifications.
~~~~~~~~~~~~~~~~~~~~~
These are all BSL licensed mods, mostly based on bug reports:
*Issue 7703: check for __BIGENDIAN__ and __LITTLEENDIAN__
* Issue 7528: patch for android:
#if defined( __ANDROID__ )
// Adroid specific code, see: https://svn.boost.org/trac/boost/ticket/7528
// Here we can use machine/_types.h, see:
// http://stackoverflow.com/questions/6212951/endianness-of-android-ndk
# include "machine/_types.h"
# ifdef __ARMEB__
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
# else
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234
# endif // __ARMEB__
#elif defined( _XBOX )
//
// XBox is always big endian??
//
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
#endif
* Issue 6013. Patch for BSD based systems:
#if defined(__NetBSD__) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || (__DragonFly__)
# if defined(__OpenBSD__)
# include