endian.hpp
Go to the documentation of this file.
00001 // Copyright 2005 Caleb Epstein
00002 // Copyright 2006 John Maddock
00003 // Distributed under the Boost Software License, Version 1.0. (See accompany-
00004 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 /*
00007  * Copyright (c) 1997
00008  * Silicon Graphics Computer Systems, Inc.
00009  *
00010  * Permission to use, copy, modify, distribute and sell this software
00011  * and its documentation for any purpose is hereby granted without fee,
00012  * provided that the above copyright notice appear in all copies and
00013  * that both that copyright notice and this permission notice appear
00014  * in supporting documentation.  Silicon Graphics makes no
00015  * representations about the suitability of this software for any
00016  * purpose.  It is provided "as is" without express or implied warranty.
00017  */
00018 
00019 /*
00020  * Copyright notice reproduced from <boost/detail/limits.hpp>, from
00021  * which this code was originally taken.
00022  *
00023  * Modified by Caleb Epstein to use <endian.h> with GNU libc and to
00024  * defined the BOOST_ENDIAN macro.
00025  */
00026 
00027 #ifndef BOOST_DETAIL_ENDIAN_HPP
00028 #define BOOST_DETAIL_ENDIAN_HPP
00029 
00030 // GNU libc offers the helpful header <endian.h> which defines
00031 // __BYTE_ORDER
00032 
00033 #if defined (__GLIBC__)
00034 # include <endian.h>
00035 # if (__BYTE_ORDER == __LITTLE_ENDIAN)
00036 #  define BOOST_LITTLE_ENDIAN
00037 # elif (__BYTE_ORDER == __BIG_ENDIAN)
00038 #  define BOOST_BIG_ENDIAN
00039 # elif (__BYTE_ORDER == __PDP_ENDIAN)
00040 #  define BOOST_PDP_ENDIAN
00041 # else
00042 #  error Unknown machine endianness detected.
00043 # endif
00044 # define BOOST_BYTE_ORDER __BYTE_ORDER
00045 #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
00046 # define BOOST_BIG_ENDIAN
00047 # define BOOST_BYTE_ORDER 4321
00048 #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
00049 # define BOOST_LITTLE_ENDIAN
00050 # define BOOST_BYTE_ORDER 1234
00051 #elif defined(__sparc) || defined(__sparc__) \
00052    || defined(_POWER) || defined(__powerpc__) \
00053    || defined(__ppc__) || defined(__hpux) \
00054    || defined(_MIPSEB) || defined(_POWER) \
00055    || defined(__s390__)
00056 # define BOOST_BIG_ENDIAN
00057 # define BOOST_BYTE_ORDER 4321
00058 #elif defined(__i386__) || defined(__alpha__) \
00059    || defined(__ia64) || defined(__ia64__) \
00060    || defined(_M_IX86) || defined(_M_IA64) \
00061    || defined(_M_ALPHA) || defined(__amd64) \
00062    || defined(__amd64__) || defined(_M_AMD64) \
00063    || defined(__x86_64) || defined(__x86_64__) \
00064    || defined(_M_X64) || defined(__bfin__)
00065 
00066 # define BOOST_LITTLE_ENDIAN
00067 # define BOOST_BYTE_ORDER 1234
00068 #else
00069 # error The file boost/detail/endian.hpp needs to be set up for your CPU type.
00070 #endif
00071 
00072 
00073 #endif


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29