On 2011-04-26 15:56, Avi Kivity wrote:
> On 04/26/2011 04:55 PM, Jan Kiszka wrote:
>> 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).
>>
>
> Note, a bool return type works here.
Yes, that was my favorite as well.
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