Re: [PATCH] Avoid a build warning on 32-bit platforms

From: Mikael Pettersson
Date: Wed Oct 20 2004 - 05:13:59 EST


On Tue, 19 Oct 2004 19:37:16 -0700, cw@xxxxxxxx (Chris Wedgwood) wrote:
>@@ -818,11 +818,12 @@
> * jiffies.
> */
> time = get_cycles();
>- if (time != 0) {
>- if (sizeof(time) > 4)
>- num ^= (u32)(time >> 32);
>- } else {
>+ if (!time)
> time = jiffies;
>+ else {
>+#if (BITS_PER_LONG > 32)
>+ num ^= (u32)(time >> 32);
>+#endif /* (BITS_PER_LONG > 32) */

There's a coding idiom for doing this: just break up
the ">> 32" in two steps, like: ((time >> 31) >> 1).
Definitely preferable over #ifdef:s.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/