summaryrefslogtreecommitdiffstats
path: root/xorg/X11R7.6/libpciaccess-0.12.0.patch
blob: 7d45d0b2f8c51de0956e48ce9ecbc1654d1d80da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff -ur a/src/common_interface.c b/src/common_interface.c
--- a/src/common_interface.c
+++ b/src/common_interface.c
@@ -51,6 +51,20 @@
 # define HTOLE_32(x)   (x)
 #endif /* linux */
 
+#elif defined(__GNUC__) || defined(__clang__)
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define LETOH_16(x)   __builtin_bswap16(x)
+# define HTOLE_16(x)   __builtin_bswap16(x)
+# define LETOH_32(x)   __builtin_bswap32(x)
+# define HTOLE_32(x)   __builtin_bswap32(x)
+#else
+# define LETOH_16(x)   (x)
+# define HTOLE_16(x)   (x)
+# define LETOH_32(x)   (x)
+# define HTOLE_32(x)   (x)
+#endif /* gcc or clang */
+
 #elif defined(__sun)
 
 #include <sys/byteorder.h>