From: "Paweł Sikora" <pluto@pld-linux.org>
To: linux-kernel@vger.kernel.org
Subject: [arm] __arch__swab32.
Date: Fri, 3 Dec 2004 17:02:19 +0100 [thread overview]
Message-ID: <200412031702.20313.pluto@pld-linux.org> (raw)
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)
reply other threads:[~2004-12-03 16:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200412031702.20313.pluto@pld-linux.org \
--to=pluto@pld-linux.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox