* [arm] __arch__swab32.
@ 2004-12-03 16:02 Paweł Sikora
0 siblings, 0 replies; only message in thread
From: Paweł Sikora @ 2004-12-03 16:02 UTC (permalink / raw)
To: linux-kernel
This function reverses the bytes in a word.
The method was discovered in 1986 following a competition between
ARM programmers. It requires just 4 instructions and 1 work register.
unsigned long reverse(unsigned long v)
{
unsigned long t;
t = v ^ ((v << 16) | (v >> 16)); // EOR r1,r0,r0,ROR #16 [*]
t &= ~0xff0000; // BIC r1,r1,#&ff0000
v = (v << 24) | (v >> 8); // MOV r0,r0,ROR #8
return v ^ (t >> 8); // EOR r0,r0,r1,LSR #8
}
Could we use the asm. optimized version instead of the generic ___swab32?
[*] http://gcc.gnu.org/PR18560
--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */
#define say(x) lie(x)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-12-03 16:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03 16:02 [arm] __arch__swab32 Paweł Sikora
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).