Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BOOST_PREDEF_ENDIAN_H
00009 #define BOOST_PREDEF_ENDIAN_H
00010
00011 #include <boost/predef/version_number.h>
00012 #include <boost/predef/make.h>
00013 #include <boost/predef/library/c/gnu.h>
00014 #include <boost/predef/os/macos.h>
00015 #include <boost/predef/os/bsd.h>
00016 #include <boost/predef/os/android.h>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
00048 #define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
00049 #define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE
00050 #define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE
00051
00052
00053
00054
00055 #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
00056 !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
00057 # if BOOST_LIB_C_GNU || BOOST_OS_ANDROID
00058 # include <endian.h>
00059 # else
00060 # if BOOST_OS_MACOS
00061 # include <machine/endian.h>
00062 # else
00063 # if BOOST_OS_BSD
00064 # if BOOST_OS_BSD_OPEN
00065 # include <machine/endian.h>
00066 # else
00067 # include <sys/endian.h>
00068 # endif
00069 # endif
00070 # endif
00071 # endif
00072 # if defined(__BYTE_ORDER)
00073 # if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN)
00074 # undef BOOST_ENDIAN_BIG_BYTE
00075 # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00076 # endif
00077 # if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN)
00078 # undef BOOST_ENDIAN_LITTLE_BYTE
00079 # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00080 # endif
00081 # if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN)
00082 # undef BOOST_ENDIAN_LITTLE_WORD
00083 # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE
00084 # endif
00085 # endif
00086 # if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER)
00087 # if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)
00088 # undef BOOST_ENDIAN_BIG_BYTE
00089 # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00090 # endif
00091 # if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)
00092 # undef BOOST_ENDIAN_LITTLE_BYTE
00093 # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00094 # endif
00095 # if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN)
00096 # undef BOOST_ENDIAN_LITTLE_WORD
00097 # define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE
00098 # endif
00099 # endif
00100 #endif
00101
00102
00103
00104 #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
00105 !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
00106 # if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \
00107 (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || \
00108 defined(__ARMEB__) || \
00109 defined(__THUMBEB__) || \
00110 defined(__AARCH64EB__) || \
00111 defined(_MIPSEB) || \
00112 defined(__MIPSEB) || \
00113 defined(__MIPSEB__)
00114 # undef BOOST_ENDIAN_BIG_BYTE
00115 # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00116 # endif
00117 #endif
00118
00119
00120
00121 #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
00122 !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
00123 # if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
00124 (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \
00125 defined(__ARMEL__) || \
00126 defined(__THUMBEL__) || \
00127 defined(__AARCH64EL__) || \
00128 defined(_MIPSEL) || \
00129 defined(__MIPSEL) || \
00130 defined(__MIPSEL__)
00131 # undef BOOST_ENDIAN_LITTLE_BYTE
00132 # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00133 # endif
00134 #endif
00135
00136
00137
00138
00139 #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
00140 !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
00141 # include <boost/predef/architecture.h>
00142 # if BOOST_ARCH_M68K || \
00143 BOOST_ARCH_PARISC || \
00144 BOOST_ARCH_SPARC || \
00145 BOOST_ARCH_SYS370 || \
00146 BOOST_ARCH_SYS390 || \
00147 BOOST_ARCH_Z
00148 # undef BOOST_ENDIAN_BIG_BYTE
00149 # define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00150 # endif
00151 # if BOOST_ARCH_AMD64 || \
00152 BOOST_ARCH_IA64 || \
00153 BOOST_ARCH_X86 || \
00154 BOOST_ARCH_BLACKFIN
00155 # undef BOOST_ENDIAN_LITTLE_BYTE
00156 # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00157 # endif
00158 #endif
00159
00160
00161
00162
00163 #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \
00164 !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD
00165 # if BOOST_ARCH_ARM
00166 # include <boost/predef/os/windows.h>
00167 # if BOOST_OS_WINDOWS
00168 # undef BOOST_ENDIAN_LITTLE_BYTE
00169 # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
00170 # endif
00171 # endif
00172 #endif
00173
00174 #if BOOST_ENDIAN_BIG_BYTE
00175 # define BOOST_ENDIAN_BIG_BYTE_AVAILABLE
00176 #endif
00177 #if BOOST_ENDIAN_BIG_WORD
00178 # define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE
00179 #endif
00180 #if BOOST_ENDIAN_LITTLE_BYTE
00181 # define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE
00182 #endif
00183 #if BOOST_ENDIAN_LITTLE_WORD
00184 # define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE
00185 #endif
00186
00187 #define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian"
00188 #define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian"
00189 #define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian"
00190 #define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian"
00191
00192 #endif
00193
00194 #include <boost/predef/detail/test.h>
00195 BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME)
00196
00197 #include <boost/predef/detail/test.h>
00198 BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME)
00199
00200 #include <boost/predef/detail/test.h>
00201 BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME)
00202
00203 #include <boost/predef/detail/test.h>
00204 BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME)