comparison bswap.h @ 521:73bbedff8e92 libavutil

ARM: ARMv6 optimised bswap_16/32
author mru
date Tue, 15 Jul 2008 19:05:49 +0000
parents f4187c1c15a6
children c0001e5c051f
comparison
equal deleted inserted replaced
520:9354d19413f3 521:73bbedff8e92
38 { 38 {
39 #if defined(ARCH_X86) 39 #if defined(ARCH_X86)
40 asm("rorw $8, %0" : "+r"(x)); 40 asm("rorw $8, %0" : "+r"(x));
41 #elif defined(ARCH_SH4) 41 #elif defined(ARCH_SH4)
42 asm("swap.b %0,%0" : "=r"(x) : "0"(x)); 42 asm("swap.b %0,%0" : "=r"(x) : "0"(x));
43 #elif defined(HAVE_ARMV6)
44 asm("rev16 %0, %0" : "+r"(x));
43 #else 45 #else
44 x= (x>>8) | (x<<8); 46 x= (x>>8) | (x<<8);
45 #endif 47 #endif
46 return x; 48 return x;
47 } 49 }
60 #elif defined(ARCH_SH4) 62 #elif defined(ARCH_SH4)
61 asm("swap.b %0,%0\n" 63 asm("swap.b %0,%0\n"
62 "swap.w %0,%0\n" 64 "swap.w %0,%0\n"
63 "swap.b %0,%0\n" 65 "swap.b %0,%0\n"
64 : "=r"(x) : "0"(x)); 66 : "=r"(x) : "0"(x));
67 #elif defined(HAVE_ARMV6)
68 asm("rev %0, %0" : "+r"(x));
65 #elif defined(ARCH_ARM) 69 #elif defined(ARCH_ARM)
66 uint32_t t; 70 uint32_t t;
67 asm ("eor %1, %0, %0, ror #16 \n\t" 71 asm ("eor %1, %0, %0, ror #16 \n\t"
68 "bic %1, %1, #0xFF0000 \n\t" 72 "bic %1, %1, #0xFF0000 \n\t"
69 "mov %0, %0, ror #8 \n\t" 73 "mov %0, %0, ror #8 \n\t"