From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOgU9-0000uZ-40 for qemu-devel@nongnu.org; Tue, 15 Jun 2010 20:28:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOgU8-0007aT-6x for qemu-devel@nongnu.org; Tue, 15 Jun 2010 20:28:04 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:48645) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOgU8-0007aE-3N for qemu-devel@nongnu.org; Tue, 15 Jun 2010 20:28:04 -0400 Received: by vws17 with SMTP id 17so2062493vws.4 for ; Tue, 15 Jun 2010 17:28:02 -0700 (PDT) Sender: Richard Henderson Message-ID: <4C181A7A.7040107@twiddle.net> Date: Tue, 15 Jun 2010 17:27:38 -0700 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Fix comparison which always returned false References: <1276635808-7315-1-git-send-email-weil@mail.berlios.de> <4C17F075.7010606@codemonkey.ws> In-Reply-To: <4C17F075.7010606@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Anthony Liguori , QEMU Developers , Gleb Natapov 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~