summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Handle.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 68f4a7a..255eacd 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -7,8 +7,20 @@
#include "config.h"
#endif
-#if defined HAVE_BYTESWAP_H && defined WORDS_BIGENDIAN
+#include "generic.h"
+
+#if defined WORDS_BIGENDIAN
+#if defined HAVE_BYTESWAP_H
#include <byteswap.h>
+#else
+inline Uint16 bswap_16(Uint16 w) {
+ return (w >> 8) | (w << 8);
+}
+
+inline Uint32 bswap_32(Uint32 w) {
+ return (w >> 24) | ((w >> 8) & 0x0000ff00) | ((w << 8) & 0x00ff0000) | (w << 24);
+}
+#endif
#endif
#ifdef HAVE_UNISTD_H