Re: [RFC][PATCH] new timeofday core subsystem (v. A3)

From: Andreas Schwab
Date: Sat Mar 12 2005 - 20:49:10 EST


Matt Mackall <mpm@xxxxxxxxxxx> writes:

> On Fri, Mar 11, 2005 at 05:24:15PM -0800, john stultz wrote:
>> +struct timesource_t timesource_jiffies = {
>> + .name = "jiffies",
>> + .priority = 0, /* lowest priority*/
>> + .type = TIMESOURCE_FUNCTION,
>> + .read_fnct = jiffies_read,
>> + .mask = (cycle_t)~0,
>
> Not sure this is right. The type of 0 is 'int' and the ~ will happen
> before the cast to a potentially longer type.

If you want an all-one value for any unsigned type then (type)-1 is the
most reliable way.

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
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/