From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEvBq-0002aE-Se for qemu-devel@nongnu.org; Wed, 06 Aug 2014 02:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEvBj-000198-Pr for qemu-devel@nongnu.org; Wed, 06 Aug 2014 02:59:14 -0400 Date: Wed, 6 Aug 2014 08:53:51 +0200 From: "Michael S. Tsirkin" Message-ID: <20140806065351.GB19566@redhat.com> References: <1406879176-4008-1-git-send-email-arei.gonglei@huawei.com> <20140805140256.GA16091@redhat.com> <53E18AAF.1090902@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53E18AAF.1090902@redhat.com> 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: Eric Blake 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, arei.gonglei@huawei.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 On Tue, Aug 05, 2014 at 07:53:51PM -0600, Eric Blake wrote: > 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. > > > > > > OK but why stop at these files? How about this > > instead? > > > > > @ disable commeq @ > > expression E; > > constant C; > > @@ > > - C == E > > + E == C > > @ disable commeq @ > > expression E; > > constant C; > > @@ > > - C == E > > + E == 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. I did, take a look at the results :) > > @ disable gtr_lss_eq @ > > expression E; > > constant C; > > @@ > > - C >= E > > + E <= C > > Ditto. > > > > > Signed-off-by: Michael S. Tsirkin > > The idea seems okay to me, but I haven't closely reviewed the patch yet. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >