summaryrefslogtreecommitdiffstats
path: root/contrib/libdvdread/P04-mingw-endian-macros.patch
blob: 872b8518d3878a3dd2162170c35e8abafc69991b (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
25
26
27
28
29
diff -Naur libdvdread.orig/dvdread/bswap.h libdvdread/dvdread/bswap.h
--- libdvdread.orig/dvdread/bswap.h	2006-06-06 16:03:37.000000000 -0400
+++ libdvdread/dvdread/bswap.h	2009-03-13 21:05:23.000000000 -0400
@@ -83,6 +83,25 @@
 #define B2N_32(x) x = OSSwapBigToHostConstInt32(x)
 #define B2N_64(x) x = OSSwapBigToHostConstInt64(x)
 
+#elif defined(__MINGW32__)
+#define B2N_16(x)                               \
+  x = ((((x) & 0xff00) >> 8) |                  \
+       (((x) & 0x00ff) << 8))
+#define B2N_32(x)                               \
+  x = ((((x) & 0xff000000) >> 24) |             \
+       (((x) & 0x00ff0000) >>  8) |             \
+       (((x) & 0x0000ff00) <<  8) |             \
+       (((x) & 0x000000ff) << 24))
+#define B2N_64(x)                               \
+  x = ((((x) & 0xff00000000000000ULL) >> 56) |     \
+       (((x) & 0x00ff000000000000ULL) >> 40) |     \
+       (((x) & 0x0000ff0000000000ULL) >> 24) |     \
+       (((x) & 0x000000ff00000000ULL) >>  8) |     \
+       (((x) & 0x00000000ff000000ULL) <<  8) |     \
+       (((x) & 0x0000000000ff0000ULL) << 24) |     \
+       (((x) & 0x000000000000ff00ULL) << 40) |     \
+       (((x) & 0x00000000000000ffULL) << 56))
+
 #else
 #if defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__BEOS__) || defined(__INTERIX)
 /* These systems don't have swap macros */