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

Mikael Pettersson
2004-10-20T10:06:55Z

On Tue, 19 Oct 2004 19:37:16 -0700, cw@f00f.org (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