| 1 | /* | 
|---|
| 2 |  * Copyright (c) 1997 | 
|---|
| 3 |  * Silicon Graphics Computer Systems, Inc. | 
|---|
| 4 |  * | 
|---|
| 5 |  * Permission to use, copy, modify, distribute and sell this software | 
|---|
| 6 |  * and its documentation for any purpose is hereby granted without fee, | 
|---|
| 7 |  * provided that the above copyright notice appear in all copies and | 
|---|
| 8 |  * that both that copyright notice and this permission notice appear | 
|---|
| 9 |  * in supporting documentation.  Silicon Graphics makes no | 
|---|
| 10 |  * representations about the suitability of this software for any | 
|---|
| 11 |  * purpose.  It is provided "as is" without express or implied warranty. | 
|---|
| 12 |  */ | 
|---|
| 13 |  | 
|---|
| 14 | /* | 
|---|
| 15 |  * Copyright notice reproduced from <boost/detail/limits.hpp>, from | 
|---|
| 16 |  * which this code was originally taken. | 
|---|
| 17 |  * | 
|---|
| 18 |  * Modified by Caleb Epstein to use <endian.h> with GNU libc and to | 
|---|
| 19 |  * defined the BOOST_ENDIAN macro. | 
|---|
| 20 |  */ | 
|---|
| 21 |  | 
|---|
| 22 | #ifndef BOOST_DETAIL_ENDIAN_HPP | 
|---|
| 23 | #define BOOST_DETAIL_ENDIAN_HPP | 
|---|
| 24 |  | 
|---|
| 25 | // GNU libc offers the helpful header <endian.h> which defines | 
|---|
| 26 | // __BYTE_ORDER | 
|---|
| 27 |  | 
|---|
| 28 | #if defined (__GLIBC__) | 
|---|
| 29 | # include <endian.h> | 
|---|
| 30 | # if (__BYTE_ORDER == __LITTLE_ENDIAN) | 
|---|
| 31 | #  define BOOST_LITTLE_ENDIAN | 
|---|
| 32 | # elif (__BYTE_ORDER == __BIG_ENDIAN) | 
|---|
| 33 | #  define BOOST_BIG_ENDIAN | 
|---|
| 34 | # elif (__BYTE_ORDER == __PDP_ENDIAN) | 
|---|
| 35 | #  define BOOST_PDP_ENDIAN | 
|---|
| 36 | # else | 
|---|
| 37 | #  error Unknown machine endianness detected. | 
|---|
| 38 | # endif | 
|---|
| 39 | # define BOOST_BYTE_ORDER __BYTE_ORDER | 
|---|
| 40 | #elif defined(__sparc) || defined(__sparc__) \ | 
|---|
| 41 |    || defined(_POWER) || defined(__powerpc__) \ | 
|---|
| 42 |    || defined(__ppc__) || defined(__hppa) \ | 
|---|
| 43 |    || defined(_MIPSEB) || defined(_POWER) \ | 
|---|
| 44 |    || defined(__s390__) | 
|---|
| 45 | # define BOOST_BIG_ENDIAN | 
|---|
| 46 | # define BOOST_BYTE_ORDER 4321 | 
|---|
| 47 | #elif defined(__i386__) || defined(__alpha__) \ | 
|---|
| 48 |    || defined(__ia64) || defined(__ia64__) \ | 
|---|
| 49 |    || defined(_M_IX86) || defined(_M_IA64) \ | 
|---|
| 50 |    || defined(_M_ALPHA) | 
|---|
| 51 | # define BOOST_LITTLE_ENDIAN | 
|---|
| 52 | # define BOOST_BYTE_ORDER 1234 | 
|---|
| 53 | #else | 
|---|
| 54 | # error The file boost/detail/endian.hpp needs to be set up for your CPU type. | 
|---|
| 55 | #endif | 
|---|
| 56 |  | 
|---|
| 57 |  | 
|---|
| 58 | #endif | 
|---|