summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-11-18 19:54:42 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-11-18 20:11:59 -0800
commitccbfd4cf2a7d203344bd1ffcb9d0024536a0eefa (patch)
tree2ea0e70af40bc4e7bb4ff1da447088cae1c8e825
parent7aca9465a61934d57781352f4fcc42b779392cd0 (diff)
Fill in byte swapping routines for big-endian Solaris machines
-rw-r--r--src/common_interface.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/common_interface.c b/src/common_interface.c
index 0cdf25d..8808fdf 100644
--- a/src/common_interface.c
+++ b/src/common_interface.c
@@ -52,10 +52,20 @@
#endif /* linux */
#elif defined(__sun)
-#define LETOH_16(x) (x)
-#define HTOLE_16(x) (x)
-#define LETOH_32(x) (x)
-#define HTOLE_32(x) (x)
+
+#include <sys/byteorder.h>
+
+#ifdef _BIG_ENDIAN
+# define LETOH_16(x) BSWAP_16(x)
+# define HTOLE_16(x) BSWAP_16(x)
+# define LETOH_32(x) BSWAP_32(x)
+# define HTOLE_32(x) BSWAP_32(x)
+#else
+# define LETOH_16(x) (x)
+# define HTOLE_16(x) (x)
+# define LETOH_32(x) (x)
+# define HTOLE_32(x) (x)
+#endif /* Solaris */
#else