|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH] Fix comparison which always returned false |
Date: | Wed, 16 Jun 2010 07:34:51 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4 |
On 06/15/2010 07:27 PM, Richard Henderson wrote:
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.
Typo on my part. I meant one filled obviously. Regards, Anthony Liguori
But I really agree with Jan Kiszka down-thread -- why do we need to signal this as a special case at all? r~
[Prev in Thread] | Current Thread | [Next in Thread] |