OSDN Git Service

Fill in byte swapping routines for big-endian Solaris machines
authorAlan Coopersmith <alan.coopersmith@sun.com>
Wed, 19 Nov 2008 03:54:42 +0000 (19:54 -0800)
committerAlan Coopersmith <alan.coopersmith@sun.com>
Wed, 19 Nov 2008 04:11:59 +0000 (20:11 -0800)
src/common_interface.c

index 0cdf25d..8808fdf 100644 (file)
 #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