diff options
Diffstat (limited to 'src/lib/mhd_byteorder.h')
-rw-r--r-- | src/lib/mhd_byteorder.h | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/src/lib/mhd_byteorder.h b/src/lib/mhd_byteorder.h index 66689804..230ae803 100644 --- a/src/lib/mhd_byteorder.h +++ b/src/lib/mhd_byteorder.h | |||
@@ -71,7 +71,8 @@ | |||
71 | #if defined(__BYTE_ORDER__) | 71 | #if defined(__BYTE_ORDER__) |
72 | #if defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | 72 | #if defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
73 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN | 73 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN |
74 | #elif defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | 74 | #elif defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == \ |
75 | __ORDER_LITTLE_ENDIAN__ | ||
75 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 76 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
76 | #elif defined(__ORDER_PDP_ENDIAN__) && __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ | 77 | #elif defined(__ORDER_PDP_ENDIAN__) && __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ |
77 | #define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN | 78 | #define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN |
@@ -106,36 +107,40 @@ | |||
106 | /* Byte order specification didn't detected in system headers */ | 107 | /* Byte order specification didn't detected in system headers */ |
107 | /* Try some guessing */ | 108 | /* Try some guessing */ |
108 | 109 | ||
109 | #if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \ | 110 | #if (defined(__BIG_ENDIAN__) && ! defined(__LITTLE_ENDIAN__)) || \ |
110 | (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) | 111 | (defined(_BIG_ENDIAN) && ! defined(_LITTLE_ENDIAN)) |
111 | /* Seems that we are on big endian platform */ | 112 | /* Seems that we are on big endian platform */ |
112 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN | 113 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN |
113 | #elif (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ | 114 | #elif (defined(__LITTLE_ENDIAN__) && ! defined(__BIG_ENDIAN__)) || \ |
114 | (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) | 115 | (defined(_LITTLE_ENDIAN) && ! defined(_BIG_ENDIAN)) |
115 | /* Seems that we are on little endian platform */ | 116 | /* Seems that we are on little endian platform */ |
116 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 117 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
117 | #elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \ | 118 | #elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \ |
118 | defined(_M_X64) || defined(_M_AMD64) || defined(i386) || defined(__i386) || \ | 119 | defined(__x86_64) || \ |
119 | defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || \ | 120 | defined(_M_X64) || defined(_M_AMD64) || defined(i386) || defined(__i386) || \ |
120 | defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) | 121 | defined(__i386__) || defined(__i486__) || defined(__i586__) || \ |
122 | defined(__i686__) || \ | ||
123 | defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) | ||
121 | /* x86 family is little endian */ | 124 | /* x86 family is little endian */ |
122 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 125 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
123 | #elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ | 126 | #elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ |
124 | defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) | 127 | defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) |
125 | /* Looks like we are on ARM/MIPS in big endian mode */ | 128 | /* Looks like we are on ARM/MIPS in big endian mode */ |
126 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN | 129 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN |
127 | #elif defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || \ | 130 | #elif defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || \ |
128 | defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) | 131 | defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) |
129 | /* Looks like we are on ARM/MIPS in little endian mode */ | 132 | /* Looks like we are on ARM/MIPS in little endian mode */ |
130 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 133 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
131 | #elif defined(__m68k__) || defined(M68000) || defined(__hppa__) || defined(__hppa) || \ | 134 | #elif defined(__m68k__) || defined(M68000) || defined(__hppa__) || \ |
132 | defined(__HPPA__) || defined(__370__) || defined(__THW_370__) || \ | 135 | defined(__hppa) || \ |
133 | defined(__s390__) || defined(__s390x__) || defined(__SYSC_ZARCH__) | 136 | defined(__HPPA__) || defined(__370__) || defined(__THW_370__) || \ |
137 | defined(__s390__) || defined(__s390x__) || defined(__SYSC_ZARCH__) | ||
134 | /* Looks like we are on big endian platform */ | 138 | /* Looks like we are on big endian platform */ |
135 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN | 139 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN |
136 | #elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) || defined(__ia64) || \ | 140 | #elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \ |
137 | defined(_M_IA64) || defined(__itanium__) || defined(__bfin__) || \ | 141 | defined(__ia64) || \ |
138 | defined(__BFIN__) || defined(bfin) || defined(BFIN) | 142 | defined(_M_IA64) || defined(__itanium__) || defined(__bfin__) || \ |
143 | defined(__BFIN__) || defined(bfin) || defined(BFIN) | ||
139 | /* Looks like we are on little endian platform */ | 144 | /* Looks like we are on little endian platform */ |
140 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 145 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
141 | #elif defined(_WIN32) | 146 | #elif defined(_WIN32) |
@@ -151,9 +156,11 @@ | |||
151 | #ifdef _MHD_BYTE_ORDER | 156 | #ifdef _MHD_BYTE_ORDER |
152 | /* Some safety checks */ | 157 | /* Some safety checks */ |
153 | #if defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN | 158 | #if defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN |
154 | #error Configure detected big endian byte order but headers specify different byte order | 159 | #error \ |
155 | #elif !defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN | 160 | Configure detected big endian byte order but headers specify different byte order |
156 | #error Configure did not detect big endian byte order but headers specify big endian byte order | 161 | #elif ! defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN |
162 | #error \ | ||
163 | Configure did not detect big endian byte order but headers specify big endian byte order | ||
157 | #endif /* !WORDS_BIGENDIAN && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN */ | 164 | #endif /* !WORDS_BIGENDIAN && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN */ |
158 | #endif /* _MHD_BYTE_ORDER */ | 165 | #endif /* _MHD_BYTE_ORDER */ |
159 | 166 | ||