From: lamont@smallone.fc.hp.com (LaMont Jones)
To: parisc-linux@lists.parisc-linux.org
Cc: lamont@hp.com
Subject: [parisc-linux] __arch__swab24()
Date: Fri, 1 Aug 2003 10:22:55 -0600 [thread overview]
Message-ID: <20030801162255.GA28998@smallone.fc.hp.com> (raw)
The following patch implements __arch__swab24() optimally for hppa.
It also has the side effect of making some other things happier. :-)
Any comments before I commit it to 2.4 and 2.5?
lamont
Index: include/asm-parisc/byteorder.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/byteorder.h,v
retrieving revision 1.7
diff -u -r1.7 byteorder.h
--- include/asm-parisc/byteorder.h 8 Jul 2003 16:50:09 -0000 1.7
+++ include/asm-parisc/byteorder.h 1 Aug 2003 16:25:00 -0000
@@ -14,6 +14,17 @@
return x;
}
+static __inline__ __const__ __u32 ___arch__swab24(__u32 x)
+{
+ unsigned int temp;
+ __asm__("shd %0, %0, 8, %1\n\t" /* shift xabcxabc -> cxab */
+ "dep %1, 15, 8, %1\n\t" /* deposit cxab -> cbab */
+ "shd %r0, %1, 8, %0" /* shift 0000cbab -> 0cba */
+ : "=r" (x), "=&r" (temp)
+ : "0" (x));
+ return x;
+}
+
static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
{
unsigned int temp;
@@ -63,6 +74,7 @@
#endif
#define __arch__swab16(x) ___arch__swab16(x)
+#define __arch__swab24(x) ___arch__swab24(x)
#define __arch__swab32(x) ___arch__swab32(x)
#endif /* __GNUC__ */
next reply other threads:[~2003-08-01 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-01 16:22 LaMont Jones [this message]
2003-08-01 17:00 ` [parisc-linux] __arch__swab24() Matthew Wilcox
2003-08-01 17:21 ` Joel Soete
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=20030801162255.GA28998@smallone.fc.hp.com \
--to=lamont@smallone.fc.hp.com \
--cc=lamont@hp.com \
--cc=parisc-linux@lists.parisc-linux.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