endian.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1997
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Permission to use, copy, modify, distribute and sell this software
00006  * and its documentation for any purpose is hereby granted without fee,
00007  * provided that the above copyright notice appear in all copies and
00008  * that both that copyright notice and this permission notice appear
00009  * in supporting documentation.  Silicon Graphics makes no
00010  * representations about the suitability of this software for any
00011  * purpose.  It is provided "as is" without express or implied warranty.
00012  */
00013 
00014 /*
00015  * Copyright notice reproduced from <sysc/packages/boost/detail/limits.hpp>, from
00016  * which this code was originally taken.
00017  *
00018  * Modified by Caleb Epstein to use <endian.h> with GNU libc and to
00019  * defined the BOOST_ENDIAN macro.
00020  */
00021 
00022 #ifndef BOOST_DETAIL_ENDIAN_HPP
00023 #define BOOST_DETAIL_ENDIAN_HPP
00024 
00025 // GNU libc offers the helpful header <endian.h> which defines
00026 // __BYTE_ORDER
00027 
00028 #if defined (__GLIBC__)
00029 # include <endian.h>
00030 # if (__BYTE_ORDER == __LITTLE_ENDIAN)
00031 #  define BOOST_LITTLE_ENDIAN
00032 # elif (__BYTE_ORDER == __BIG_ENDIAN)
00033 #  define BOOST_BIG_ENDIAN
00034 # elif (__BYTE_ORDER == __PDP_ENDIAN)
00035 #  define BOOST_PDP_ENDIAN
00036 # else
00037 #  error Unknown machine endianness detected.
00038 # endif
00039 # define BOOST_BYTE_ORDER __BYTE_ORDER
00040 #elif defined(__sparc) || defined(__sparc__) \
00041    || defined(_POWER) || defined(__powerpc__) \
00042    || defined(__ppc__) || defined(__hppa) \
00043    || defined(_MIPSEB) || defined(_POWER) \
00044    || defined(__s390__)
00045 # define BOOST_BIG_ENDIAN
00046 # define BOOST_BYTE_ORDER 4321
00047 #elif defined(__i386__) || defined(__alpha__) \
00048    || defined(__ia64) || defined(__ia64__) \
00049    || defined(_M_IX86) || defined(_M_IA64) \
00050    || defined(_M_ALPHA)
00051 # define BOOST_LITTLE_ENDIAN
00052 # define BOOST_BYTE_ORDER 1234
00053 #else
00054 # error The file boost/detail/endian.hpp needs to be set up for your CPU type.
00055 #endif
00056 
00057 
00058 #endif

Generated on Wed Jan 21 15:32:09 2009 for SystemC by  doxygen 1.5.5