Add endian macros for BSD.
authorEric Anholt <anholt@FreeBSD.org>
Sun, 30 Jul 2006 21:29:58 +0000 (14:29 -0700)
committerEric Anholt <anholt@FreeBSD.org>
Sun, 30 Jul 2006 21:30:53 +0000 (14:30 -0700)
src/common_interface.c

index d2923dd..67e8e9a 100644 (file)
@@ -35,6 +35,7 @@
 #include "pciaccess.h"
 #include "pciaccess_private.h"
 
+#ifdef __linux__
 #include <byteswap.h>
 
 #if __BYTE_ORDER == __BIG_ENDIAN
 # define HTOLE_32(x)   (x)
 #endif
 
+#else
+
+#include <sys/endian.h>
+
+#define LETOH_16(x)    le16toh(x)
+#define HTOLE_16(x)    htole16(x)
+#define LETOH_32(x)    le32toh(x)
+#define HTOLE_32(x)    htole32(x)
+
+#endif
+
 /**
  * Read a device's expansion ROM.
  *