[PATCH libpciaccess] common_interface.c: Use proper byteswap functions on APPLE systems

shea at shealevy.com shea at shealevy.com
Mon Aug 29 00:53:16 PDT 2011


APPLE systems do not have <sys/endian.h>, they have
<architecture/byte_order.h> instead.
Signed-off-by: Shea Levy <shea at shealevy.com>
---
 src/common_interface.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/common_interface.c b/src/common_interface.c
index 4af772a..6ede9dd 100644
--- a/src/common_interface.c
+++ b/src/common_interface.c
@@ -67,6 +67,22 @@
 # define HTOLE_32(x)   (x)
 #endif /* Solaris */

+#elif defined(__APPLE__)
+
+#include <architecture/byte_order.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define LETOH_16(x)   OSSwapInt16(x)
+# define HTOLE_16(x)   OSSwapInt16(x)
+# define LETOH_32(x)   OSSwapInt32(x)
+# define HTOLE_32(x)   OSSwapInt32(x)
+#else
+# define LETOH_16(x)   (x)
+# define HTOLE_16(x)   (x)
+# define LETOH_32(x)   (x)
+# define HTOLE_32(x)   (x)
+#endif /* darwin */
+
 #else

 #include <sys/endian.h>
-- 
1.7.6




More information about the xorg-devel mailing list