summaryrefslogtreecommitdiff
path: root/apps/codecs/lib/ffmpeg_bswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/lib/ffmpeg_bswap.h')
-rw-r--r--apps/codecs/lib/ffmpeg_bswap.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/codecs/lib/ffmpeg_bswap.h b/apps/codecs/lib/ffmpeg_bswap.h
index b083d10ed0..24a2aab7ea 100644
--- a/apps/codecs/lib/ffmpeg_bswap.h
+++ b/apps/codecs/lib/ffmpeg_bswap.h
@@ -34,8 +34,8 @@ static inline uint64_t ByteSwap64(uint64_t x)
34#elif defined(ARCH_X86) 34#elif defined(ARCH_X86)
35static inline unsigned short ByteSwap16(unsigned short x) 35static inline unsigned short ByteSwap16(unsigned short x)
36{ 36{
37 __asm("xchgb %b0,%h0" : 37 __asm("xchgb %b0,%h0" :
38 "=q" (x) : 38 "=q" (x) :
39 "0" (x)); 39 "0" (x));
40 return x; 40 return x;
41} 41}
@@ -44,13 +44,13 @@ static inline unsigned short ByteSwap16(unsigned short x)
44static inline unsigned int ByteSwap32(unsigned int x) 44static inline unsigned int ByteSwap32(unsigned int x)
45{ 45{
46#if __CPU__ > 386 46#if __CPU__ > 386
47 __asm("bswap %0": 47 __asm("bswap %0":
48 "=r" (x) : 48 "=r" (x) :
49#else 49#else
50 __asm("xchgb %b0,%h0\n" 50 __asm("xchgb %b0,%h0\n"
51 " rorl $16,%0\n" 51 " rorl $16,%0\n"
52 " xchgb %b0,%h0": 52 " xchgb %b0,%h0":
53 "=q" (x) : 53 "=q" (x) :
54#endif 54#endif
55 "0" (x)); 55 "0" (x));
56 return x; 56 return x;
@@ -61,7 +61,7 @@ static inline unsigned long long int ByteSwap64(unsigned long long int x)
61{ 61{
62 register union { __extension__ uint64_t __ll; 62 register union { __extension__ uint64_t __ll;
63 uint32_t __l[2]; } __x; 63 uint32_t __l[2]; } __x;
64 asm("xchgl %0,%1": 64 asm("xchgl %0,%1":
65 "=r"(__x.__l[0]),"=r"(__x.__l[1]): 65 "=r"(__x.__l[0]),"=r"(__x.__l[1]):
66 "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32)))); 66 "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
67 return __x.__ll; 67 return __x.__ll;
@@ -71,17 +71,17 @@ static inline unsigned long long int ByteSwap64(unsigned long long int x)
71#elif defined(ARCH_SH4) 71#elif defined(ARCH_SH4)
72 72
73static inline uint16_t ByteSwap16(uint16_t x) { 73static inline uint16_t ByteSwap16(uint16_t x) {
74 __asm__("swap.b %0,%0":"=r"(x):"0"(x)); 74 __asm__("swap.b %0,%0":"=r"(x):"0"(x));
75 return x; 75 return x;
76} 76}
77 77
78static inline uint32_t ByteSwap32(uint32_t x) { 78static inline uint32_t ByteSwap32(uint32_t x) {
79 __asm__( 79 __asm__(
80 "swap.b %0,%0\n" 80 "swap.b %0,%0\n"
81 "swap.w %0,%0\n" 81 "swap.w %0,%0\n"
82 "swap.b %0,%0\n" 82 "swap.b %0,%0\n"
83 :"=r"(x):"0"(x)); 83 :"=r"(x):"0"(x));
84 return x; 84 return x;
85} 85}
86 86
87#define bswap_16(x) ByteSwap16(x) 87#define bswap_16(x) ByteSwap16(x)
@@ -124,9 +124,9 @@ static inline uint64_t ByteSwap64(uint64_t x)
124} 124}
125#define bswap_64(x) ByteSwap64(x) 125#define bswap_64(x) ByteSwap64(x)
126 126
127#endif /* !ARCH_X86 */ 127#endif /* !ARCH_X86 */
128 128
129#endif /* !HAVE_BYTESWAP_H */ 129#endif /* !HAVE_BYTESWAP_H */
130 130
131// be2me ... BigEndian to MachineEndian 131// be2me ... BigEndian to MachineEndian
132// le2me ... LittleEndian to MachineEndian 132// le2me ... LittleEndian to MachineEndian