[vlc-devel] commit: Use FreeBSD's be16toh() when available ( Rafaël Carré )

git version control git at videolan.org
Sun May 25 15:20:16 CEST 2008


vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Sun May 25 15:21:49 2008 +0200| [a6144dde169f94f8ed6ba97719c0284d6ee96ac9]

Use FreeBSD's be16toh() when available

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a6144dde169f94f8ed6ba97719c0284d6ee96ac9
---

 modules/video_filter/swscale/common.h |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/video_filter/swscale/common.h b/modules/video_filter/swscale/common.h
index f4c8606..c73121a 100644
--- a/modules/video_filter/swscale/common.h
+++ b/modules/video_filter/swscale/common.h
@@ -36,7 +36,10 @@ extern void *( *swscale_fast_memcpy )( void *, const void *, int );
 #define MANGLE(a) #a
 #endif
 
-#ifdef ARCH_X86
+#if defined(__FreeBSD__) && __FreeBSD__ >= 5
+#   include <sys/endian.h>
+#   define bswap_16(x) be16toh(x)
+#elif defined(ARCH_X86)
 static inline unsigned short ByteSwap16(unsigned short x)
 {
   __asm("xchgb %b0,%h0" :
@@ -44,10 +47,9 @@ static inline unsigned short ByteSwap16(unsigned short x)
         "0" (x));
     return x;
 }
-#define bswap_16(x) ByteSwap16(x)
+#   define bswap_16(x) ByteSwap16(x)
 #else
-
-#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
+#   define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
 #endif  /* !ARCH_X86 */
 
 /* SWSCALE image formats */




More information about the vlc-devel mailing list