From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3OcH-0006D4-BL for qemu-devel@nongnu.org; Fri, 12 Jun 2015 09:03:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3OcC-00023R-RV for qemu-devel@nongnu.org; Fri, 12 Jun 2015 09:03:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3OcC-00022v-Mv for qemu-devel@nongnu.org; Fri, 12 Jun 2015 09:03:20 -0400 Message-ID: <557AD891.90904@redhat.com> Date: Fri, 12 Jun 2015 07:03:13 -0600 From: Eric Blake MIME-Version: 1.0 References: <20150612103816.17529.55642.malonedeb@chaenomeles.canonical.com> <20150612103816.17529.55642.malonedeb@chaenomeles.canonical.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="klt4AH4xQcJwg4cHTnulBouCF4FeITj2L" Subject: Re: [Qemu-devel] [Bug 1464611] [NEW] 4 * redundant conditions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Bug 1464611 <1464611@bugs.launchpad.net> Cc: QEMU Developers This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --klt4AH4xQcJwg4cHTnulBouCF4FeITj2L Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/12/2015 05:01 AM, Peter Maydell wrote: >> 4. >> >> [qemu/target-arm/translate-a64.c:5729]: (style) Redundant condition: >> size<3. 'A && (!A || B)' is equivalent to 'A || B' >> >> if (size > 3 >> || (size < 3 && is_q) >> || (size =3D=3D 3 && !is_q)) { >=20 > ...but I'm less sure about this one. I'm not even sure > what it's trying to suggest this should simplify to: > just dropping "size < 3" is obviously wrong, and the > condition format isn't "A && (!A || B)" either. Let's break it down into the 6 possibilities based on the binary * ternary conditions being checked: > 3, is_q =3D> accept > 3, !is_q =3D> accept =3D=3D 3, is_q =3D> reject =3D=3D 3, !is_q =3D> accept < 3, is_q =3D> accept < 3, !is_q =3D> reject Here's a shorter conditional with the same properties, but it's gross: if (size > 3 || (is_q !=3D (size =3D=3D 3))) { Too much mental thought to prove it accepts the same set of conditions. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --klt4AH4xQcJwg4cHTnulBouCF4FeITj2L 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVetiRAAoJEKeha0olJ0Nq3M0IAJTJV9a6cgwVl9bY3F9DDTab YPs8J6rpLo9eI9alcdt+e2GX7+GML7SKLaEEyaV+yEooY5bA/Q8/0i/APqQxU/Zi FekpWyZYUXbYiHEARsyfu92inNbcAiP283l0EvIM4u6E7egepLcgoTJdEN39VV+C ggRBlFO2O+r5UCc4FUgty77+8njuWrRNGfgOU/3b5gERuPpmcR4GIjo6E2b+Iomt oS0bsEc9HjgYQ5bMA4H2UIOxIHhaeEaNbmg6ESQdUhs0gOn51JDRWGGZzQNm9NFA zdpN534qhCDeHBijsUJ5FxVwh4Dsfe12H6U4/QPg8TPq0Fr87zul2QhfEUYRo7k= =Fl+v -----END PGP SIGNATURE----- --klt4AH4xQcJwg4cHTnulBouCF4FeITj2L--