On 2011-04-26 15:30, Michael Tokarev wrote:
> 26.04.2011 17:19, Jan Kiszka wrote:
>
>> hw/hpet.c | 71
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>
>> +static int modifying_bit(uint64_t old, uint64_t new, uint64_t mask)
>> +{
>> + return (old ^ new) & mask;
>> +}
>
> Such constructs always look suspicious. I'm not even sure anymore
> (after using C for over 20 years ;) that this works... how about
>
> return (old ^ new) & mask ? 1 : 0;
>
> instead, or something along this? I mean, if sizeof(int)==4, how
> `return 1ULL<<32' will be interpreted in this context? Tiny test
> program tells me it will return 0...
Good catch, will fix (doesn't bite use here, flags fit into 32 bit, but
nevertheless).
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html