From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33902 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOrpZ-0005tW-HN for qemu-devel@nongnu.org; Wed, 16 Jun 2010 08:34:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOrpY-0000My-BK for qemu-devel@nongnu.org; Wed, 16 Jun 2010 08:34:57 -0400 Received: from mail-yw0-f190.google.com ([209.85.211.190]:42551) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOrpY-0000Ms-6b for qemu-devel@nongnu.org; Wed, 16 Jun 2010 08:34:56 -0400 Received: by ywh28 with SMTP id 28so4649314ywh.28 for ; Wed, 16 Jun 2010 05:34:55 -0700 (PDT) Message-ID: <4C18C4EB.9070001@codemonkey.ws> Date: Wed, 16 Jun 2010 07:34:51 -0500 From: Anthony Liguori 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> <4C181A7A.7040107@twiddle.net> In-Reply-To: <4C181A7A.7040107@twiddle.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Anthony Liguori , QEMU Developers , Gleb Natapov 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~ >