forked from len0rd/rockbox
Assembler optimised swap32 for ARM.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9072 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
310d191f06
commit
70ab7fc4e9
1 changed files with 10 additions and 3 deletions
|
|
@ -463,9 +463,16 @@ static inline unsigned long swap32(unsigned long value)
|
||||||
result[ 7.. 0] = value[31..24];
|
result[ 7.. 0] = value[31..24];
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned long hi = swap16(value >> 16);
|
unsigned int tmp;
|
||||||
unsigned long lo = swap16(value & 0xffff);
|
|
||||||
return (lo << 16) | hi;
|
asm volatile (
|
||||||
|
"eor %1, %0, %0, ror #16 \n\t"
|
||||||
|
"bic %1, %1, #0xff0000 \n\t"
|
||||||
|
"mov %0, %0, ror #8 \n\t"
|
||||||
|
"eor %0, %0, %1, lsr #8 \n\t"
|
||||||
|
: "+r" (value), "=r" (tmp)
|
||||||
|
);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue