Mercurial > libavutil.hg
comparison bswap.h @ 327:e9ee070db39b libavutil
Faster 32 bit byteswaping code for Blackfin.
200% faster on BF537 compiled with gcc 4.1.
patch by Marc Hoffman, mmh pleasantst com
author | diego |
---|---|
date | Tue, 24 Apr 2007 23:21:29 +0000 |
parents | 039198e96ee2 |
children | ecb4776617e1 |
comparison
equal
deleted
inserted
replaced
326:46b4da5bf9ed | 327:e9ee070db39b |
---|---|
123 "mov %0, %0, ror #8 \n\t" | 123 "mov %0, %0, ror #8 \n\t" |
124 "eor %0, %0, %1, lsr #8 \n\t" | 124 "eor %0, %0, %1, lsr #8 \n\t" |
125 : "+r"(x), "+r"(t)); | 125 : "+r"(x), "+r"(t)); |
126 return x; | 126 return x; |
127 } | 127 } |
128 | |
129 #elif defined(ARCH_BFIN) | |
130 static av_always_inline uint32_t bswap_32(uint32_t x){ | |
131 unsigned tmp; | |
132 asm("%1 = %0 >> 8 (V);\n\t" | |
133 "%0 = %0 << 8 (V);\n\t" | |
134 "%0 = %0 | %1;\n\t" | |
135 "%0 = PACK(%0.L, %0.H);\n\t" | |
136 : "+d"(x), "=&d"(tmp)); | |
137 return x; | |
138 } | |
139 | |
128 #else | 140 #else |
129 static av_always_inline uint32_t bswap_32(uint32_t x){ | 141 static av_always_inline uint32_t bswap_32(uint32_t x){ |
130 x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | 142 x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); |
131 return (x>>16) | (x<<16); | 143 return (x>>16) | (x<<16); |
132 } | 144 } |