From: Chris Wedgwood <cw@f00f.org>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH (updated)] Avoid annoying build warning on 32-bit platforms
Date: Wed, 20 Oct 2004 03:23:43 -0700 [thread overview]
Message-ID: <20041020102343.GA6901@taniwha.stupidest.org> (raw)
In-Reply-To: <200410200956.i9K9ujOu026178@harpo.it.uu.se>
On Wed, Oct 20, 2004 at 11:56:45AM +0200, Mikael Pettersson wrote:
> There's a coding idiom for doing this: just break up
> the ">> 32" in two steps, like: ((time >> 31) >> 1).
i assumed gcc would complain there too but it doesn't and it does
optimize this away (i checked)
> Definitely preferable over #ifdef:s.
indeed
Avoid annoying gcc warning on 32-bit platforms.
Signed-off-by: cw@f00f.org
===== drivers/char/random.c 1.57 vs edited =====
--- 1.57/drivers/char/random.c 2004-10-05 14:21:53 -07:00
+++ edited/drivers/char/random.c 2004-10-20 03:19:17 -07:00
@@ -818,12 +818,10 @@ static void add_timer_randomness(struct
* jiffies.
*/
time = get_cycles();
- if (time != 0) {
- if (sizeof(time) > 4)
- num ^= (u32)(time >> 32);
- } else {
+ if (time)
+ num ^= (u32)((time >> 32) >> 1);
+ else
time = jiffies;
- }
/*
* Calculate number of bits of randomness we probably added.
next prev parent reply other threads:[~2004-10-20 10:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 9:56 [PATCH] Avoid a build warning on 32-bit platforms Mikael Pettersson
2004-10-20 10:23 ` Chris Wedgwood [this message]
2004-10-20 10:42 ` [PATCH (updated)] Avoid annoying " Jakub Jelinek
2004-10-20 10:53 ` Martin Zwickel
2004-10-20 19:18 ` Chris Wedgwood
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=20041020102343.GA6901@taniwha.stupidest.org \
--to=cw@f00f.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@csd.uu.se \
--cc=torvalds@osdl.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