aboutsummaryrefslogtreecommitdiff
path: root/include/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/platform.h')
-rw-r--r--include/platform.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/platform.h b/include/platform.h
index ed8c137e1..c20d2aef6 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -160,6 +160,7 @@
160 160
161/* ---- Endian Detection ------------------------------------ */ 161/* ---- Endian Detection ------------------------------------ */
162 162
163#include <limits.h>
163#if defined(__digital__) && defined(__unix__) 164#if defined(__digital__) && defined(__unix__)
164# include <sex.h> 165# include <sex.h>
165#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ 166#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
@@ -207,6 +208,10 @@
207# error "Can't determine endianness" 208# error "Can't determine endianness"
208#endif 209#endif
209 210
211#if ULONG_MAX > 0xffffffff
212# define bb_bswap_64(x) bswap_64(x)
213#endif
214
210/* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */ 215/* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */
211#if BB_BIG_ENDIAN 216#if BB_BIG_ENDIAN
212# define SWAP_BE16(x) (x) 217# define SWAP_BE16(x) (x)
@@ -214,13 +219,13 @@
214# define SWAP_BE64(x) (x) 219# define SWAP_BE64(x) (x)
215# define SWAP_LE16(x) bswap_16(x) 220# define SWAP_LE16(x) bswap_16(x)
216# define SWAP_LE32(x) bswap_32(x) 221# define SWAP_LE32(x) bswap_32(x)
217# define SWAP_LE64(x) bswap_64(x) 222# define SWAP_LE64(x) bb_bswap_64(x)
218# define IF_BIG_ENDIAN(...) __VA_ARGS__ 223# define IF_BIG_ENDIAN(...) __VA_ARGS__
219# define IF_LITTLE_ENDIAN(...) 224# define IF_LITTLE_ENDIAN(...)
220#else 225#else
221# define SWAP_BE16(x) bswap_16(x) 226# define SWAP_BE16(x) bswap_16(x)
222# define SWAP_BE32(x) bswap_32(x) 227# define SWAP_BE32(x) bswap_32(x)
223# define SWAP_BE64(x) bswap_64(x) 228# define SWAP_BE64(x) bb_bswap_64(x)
224# define SWAP_LE16(x) (x) 229# define SWAP_LE16(x) (x)
225# define SWAP_LE32(x) (x) 230# define SWAP_LE32(x) (x)
226# define SWAP_LE64(x) (x) 231# define SWAP_LE64(x) (x)