summaryrefslogtreecommitdiff
path: root/multimedia/ffmpeg-devel/files/patch-libavcodec::bswap.h
blob: 8bef16c36abcf987a1a4442f5d252b251321adbd (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- libavcodec/bswap.h.orig	Sun Dec  5 16:03:35 2004
+++ libavcodec/bswap.h	Sun Dec  5 16:06:48 2004
@@ -10,6 +10,14 @@
 #include <byteswap.h>
 #else
 
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
+#if defined(__FreeBSD__) && __FreeBSD_version >= 470000
+#include <sys/endian.h>
+#endif
+
 #ifdef ARCH_X86
 static inline unsigned short ByteSwap16(unsigned short x)
 {
@@ -18,7 +26,11 @@
         "0" (x));
     return x;
 }
+#if defined(__FreeBSD__) && __FreeBSD_version >= 470000
+#define bswap_16(x) (be16toh(x))
+#else
 #define bswap_16(x) ByteSwap16(x)
+#endif
 
 static inline unsigned int ByteSwap32(unsigned int x)
 {
@@ -34,7 +46,11 @@
       "0" (x));
   return x;
 }
+#if defined(__FreeBSD__) && __FreeBSD_version >= 470000
+#define bswap_32(x) (be32toh(x))
+#else
 #define bswap_32(x) ByteSwap32(x)
+#endif
 
 static inline unsigned long long int ByteSwap64(unsigned long long int x)
 {
@@ -45,7 +61,11 @@
       "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
   return __x.__ll;
 }
+#if defined(__FreeBSD__) && __FreeBSD_version >= 510000
+#define bswap_64(x) (be64toh(x))
+#else
 #define bswap_64(x) ByteSwap64(x)
+#endif
 
 #elif defined(ARCH_SH4)