From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50236 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOdgh-0005uX-VN for qemu-devel@nongnu.org; Tue, 15 Jun 2010 17:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOdgg-0001kO-Q4 for qemu-devel@nongnu.org; Tue, 15 Jun 2010 17:28:51 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:35491) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOdgg-0001k4-ET for qemu-devel@nongnu.org; Tue, 15 Jun 2010 17:28:50 -0400 Message-ID: <4C17F08A.5020004@web.de> Date: Tue, 15 Jun 2010 23:28:42 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1276635808-7315-1-git-send-email-weil@mail.berlios.de> In-Reply-To: <1276635808-7315-1-git-send-email-weil@mail.berlios.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig49D70DA4D5EFF9A6CDE34B3F" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] Fix comparison which always returned false List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Anthony Liguori , QEMU Developers , Gleb Natapov This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig49D70DA4D5EFF9A6CDE34B3F Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable 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). >=20 > Cc: Gleb Natapov > Cc: Anthony Liguori > Signed-off-by: Stefan Weil > --- > hw/hpet.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/hpet.c b/hw/hpet.c > index 0c80ee5..d5c406c 100644 > --- a/hw/hpet.c > +++ b/hw/hpet.c > @@ -74,7 +74,7 @@ typedef struct HPETState { > uint8_t hpet_id; /* instance id */ > } HPETState; > =20 > -struct hpet_fw_config hpet_cfg =3D {.count =3D ~0}; > +struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; > =20 > static uint32_t hpet_in_legacy_mode(HPETState *s) > { > @@ -682,8 +682,10 @@ static int hpet_init(SysBusDevice *dev) > int i, iomemtype; > HPETTimer *timer; > =20 > - if (hpet_cfg.count =3D=3D ~0) /* first instance */ > + if (hpet_cfg.count =3D=3D UINT8_MAX) { > + /* first instance */ > hpet_cfg.count =3D 0; > + } > =20 > if (hpet_cfg.count =3D=3D 8) { > fprintf(stderr, "Only 8 instances of HPET is allowed\n"); That makes me wonder why we need to signal this special value of hpet_cfg.count to seabios at all. Why isn't plain 0 for no hpets sufficient, Gleb? Jan --------------enig49D70DA4D5EFF9A6CDE34B3F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkwX8I8ACgkQitSsb3rl5xReUwCg05HpkqWrOCjXMdS74KzfscmH /O8An0ht3g985iI5yjUJFv/ivUNZgHa8 =O2Vn -----END PGP SIGNATURE----- --------------enig49D70DA4D5EFF9A6CDE34B3F--