From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEqRU-0001Q8-Ts for qemu-devel@nongnu.org; Tue, 05 Aug 2014 21:55:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEqRP-0001S7-9Y for qemu-devel@nongnu.org; Tue, 05 Aug 2014 21:55:04 -0400 Message-ID: <53E18AAF.1090902@redhat.com> Date: Tue, 05 Aug 2014 19:53:51 -0600 From: Eric Blake MIME-Version: 1.0 References: <1406879176-4008-1-git-send-email-arei.gonglei@huawei.com> <20140805140256.GA16091@redhat.com> In-Reply-To: <20140805140256.GA16091@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="so9wFLtxonhCdBr5GK1BS198DuUWFWubg" Subject: Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , arei.gonglei@huawei.com Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, weidong.huang@huawei.com, stefanha@redhat.com, marcel.a@redhat.com, qemu-trivial@nongnu.org, luonengjun@huawei.com, qemu-devel@nongnu.org, armbru@redhat.com, av1474@comtv.ru, kraxel@redhat.com, aliguori@amazon.com, imammedo@redhat.com, dmitry@daynix.com, pbonzini@redhat.com, peter.huangpeng@huawei.com, lcapitulino@redhat.com, afaerber@suse.de, dgilbert@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --so9wFLtxonhCdBr5GK1BS198DuUWFWubg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/05/2014 08:02 AM, Michael S. Tsirkin wrote: > On Fri, Aug 01, 2014 at 03:46:08PM +0800, arei.gonglei@huawei.com wrote= : >> From: Gonglei >> >> $WHATEVER: don't use 'Yoda conditions' >> >> 'Yoda conditions' are not part of idiomatic QEMU coding >> style, so rewrite them in the more usual order. >=20 >=20 > OK but why stop at these files? How about this > instead? >=20 > @ disable commeq @ > expression E; > constant C; > @@ > - C =3D=3D E > + E =3D=3D C > @ disable commeq @ > expression E; > constant C; > @@ > - C =3D=3D E > + E =3D=3D C Why is this listed twice? > @ disable gtr_lss @ > expression E; > constant C; > @@ > - C > E > + E < C This is wrong for floating point (think NaN); you'd have to audit the results to make sure only integers are commuted. > @ disable gtr_lss_eq @ > expression E; > constant C; > @@ > - C >=3D E > + E <=3D C Ditto. >=20 > Signed-off-by: Michael S. Tsirkin The idea seems okay to me, but I haven't closely reviewed the patch yet. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --so9wFLtxonhCdBr5GK1BS198DuUWFWubg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT4YqwAAoJEKeha0olJ0NqSx0IAK4PBdl+wZ2E6+2a3tq9OM9W lTd3Zd4QbzSmJ3HrlXnUVGCrJDiZ3gKSIn7gzUn46so/H+/pLUfXH92pipYOMT5z 6pP2iljpUVw273Enge+yQnhK8cMXxsGOCvlYjEMkl4RSp0tm1pmPFaqssgm3X++9 GxWQHqBIYtS+FKRjrHR0xZxaKizgUpv2BOC3TP49tiDV0RxEc0WnbF2txxzTmoUL 9IqhG7/JFywNp5mGHTKH+1pOyKm3yrsrWyrD0478LelVT2/kF0CrH/sR+4sxgX0L vji9gHd6z+QcsMD2Y47kFMG5Gww47iZ/803egLfSb7IIyhVcQZxKED4SxeJ8fRY= =ohrH -----END PGP SIGNATURE----- --so9wFLtxonhCdBr5GK1BS198DuUWFWubg--