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