From: Chuck Ebbert <76306.1226@compuserve.com>
To: Matt Mackall <mpm@selenic.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>, Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@suse.de>
Subject: Re: [PATCH 1/12] random pt4: Create new rol32/ror32 bitops
Date: Sat, 22 Jan 2005 21:10:40 -0500 [thread overview]
Message-ID: <200501222113_MC3-1-940A-5393@compuserve.com> (raw)
On Fri, 21 Jan 2005 at 15:41:06 -0600 Matt Mackall wrote:
> Add rol32 and ror32 bitops to bitops.h
Can you test this patch on top of yours? I did it on 2.6.10-ac10 but it
should apply OK. Compile tested and booted, but only random.c is using it
in my kernel.
x86-64 could use this too...
Add i386 bitops for rol32/ror32:
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
--- 2.6.10-ac10/include/linux/bitops.h~orig 2005-01-22 11:31:20.130239000 -0500
+++ 2.6.10-ac10/include/linux/bitops.h 2005-01-22 11:34:55.740239000 -0500
@@ -129,6 +129,7 @@
return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
}
+#ifndef __HAVE_ARCH_ROTATE_32
/*
* rol32 - rotate a 32-bit value left
*
@@ -150,5 +151,6 @@
{
return (word >> shift) | (word << (32 - shift));
}
+#endif /* ndef __HAVE_ARCH_ROTATE_32 */
#endif
--- 2.6.10-ac10/include/asm-i386/bitops.h~orig 2004-08-24 05:08:39.000000000 -0400
+++ 2.6.10-ac10/include/asm-i386/bitops.h 2005-01-22 11:42:12.010239000 -0500
@@ -431,6 +431,41 @@
#define hweight16(x) generic_hweight16(x)
#define hweight8(x) generic_hweight8(x)
+#define __HAVE_ARCH_ROTATE_32
+/*
+ * rol32 - rotate a 32-bit value left
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 rol32(__u32 word, int shift)
+{
+ __u32 res;
+
+ asm("roll %%cl,%0"
+ : "=r" (res)
+ : "0" (word), "c" (shift)
+ : "cc");
+ return res;
+}
+
+/*
+ * ror32 - rotate a 32-bit value right
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 ror32(__u32 word, int shift)
+{
+ __u32 res;
+
+ asm("rorl %%cl,%0"
+ : "=r" (res)
+ : "0" (word), "c" (shift)
+ : "cc");
+ return res;
+}
+
#endif /* __KERNEL__ */
#ifdef __KERNEL__
Chuck
next reply other threads:[~2005-01-23 2:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-23 2:10 Chuck Ebbert [this message]
2005-01-23 2:45 ` Matt Mackall
2005-01-23 3:19 ` Andi Kleen
2005-01-23 4:13 ` Matt Mackall
-- strict thread matches above, loose matches on Subject: below --
2005-01-23 7:44 Chuck Ebbert
2005-01-24 22:16 ` H. Peter Anvin
2005-01-21 21:41 [PATCH 0/12] random pt4: Moving and sharing code Matt Mackall
2005-01-21 21:41 ` [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Matt Mackall
2005-01-25 21:02 ` Denis Vlasenko
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=200501222113_MC3-1-940A-5393@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=tytso@mit.edu \
/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
all inboxes | Powered by JetHome®