Commit a6144dde authored by Rafaël Carré's avatar Rafaël Carré

Use FreeBSD's be16toh() when available

parent 2444a87b
...@@ -36,7 +36,10 @@ extern void *( *swscale_fast_memcpy )( void *, const void *, int ); ...@@ -36,7 +36,10 @@ extern void *( *swscale_fast_memcpy )( void *, const void *, int );
#define MANGLE(a) #a #define MANGLE(a) #a
#endif #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) static inline unsigned short ByteSwap16(unsigned short x)
{ {
__asm("xchgb %b0,%h0" : __asm("xchgb %b0,%h0" :
...@@ -44,10 +47,9 @@ static inline unsigned short ByteSwap16(unsigned short x) ...@@ -44,10 +47,9 @@ static inline unsigned short ByteSwap16(unsigned short x)
"0" (x)); "0" (x));
return x; return x;
} }
#define bswap_16(x) ByteSwap16(x) # define bswap_16(x) ByteSwap16(x)
#else #else
# define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
#endif /* !ARCH_X86 */ #endif /* !ARCH_X86 */
/* SWSCALE image formats */ /* SWSCALE image formats */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment