[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH v3 for-2.2 0/8] don't use Yoda conditions
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-trivial] [PATCH v3 for-2.2 0/8] don't use Yoda conditions |
Date: |
Wed, 6 Aug 2014 08:53:51 +0200 |
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, address@hidden wrote:
> >> From: Gonglei <address@hidden>
> >>
> >> $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 <address@hidden>
>
> 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
>