[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Fix comparison which always returned false
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] Fix comparison which always returned false |
Date: |
Tue, 15 Jun 2010 17:27:38 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Thunderbird/3.0.4 |
On 06/15/2010 02:28 PM, Anthony Liguori wrote:
> On 06/15/2010 04:03 PM, Stefan Weil wrote:
>> Comparing an 8 bit value with ~0 does not work as expected.
>> Replace ~0 by UINT8_MAX in comparison and also in assignment
>> (and fix coding style, too).
>>
>
> Because when the uint8_t gets promoted, it doesn't get zero filled. I'd
> rather something a bit more obvious like HPET_INVALID_COUNT.
Er, yes it does. The problem is that it *did* get zero-extended,
but ~0 is 0xffffffff, so the comparison fails.
But I really agree with Jan Kiszka down-thread -- why do we need
to signal this as a special case at all?
r~