From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46861 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oocdc-00034q-FS for qemu-devel@nongnu.org; Thu, 26 Aug 2010 09:37:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oocdb-000540-1D for qemu-devel@nongnu.org; Thu, 26 Aug 2010 09:37:04 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:54944) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oocda-00053n-TH for qemu-devel@nongnu.org; Thu, 26 Aug 2010 09:37:03 -0400 Received: by eyf18 with SMTP id 18so1365758eyf.4 for ; Thu, 26 Aug 2010 06:37:01 -0700 (PDT) Date: Thu, 26 Aug 2010 15:23:13 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH] Correct use of ! and & Message-ID: <20100826132313.GA32336@edde.se.axis.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel On Sat, Aug 21, 2010 at 09:42:51AM +0000, Blue Swirl wrote: > Combining bitwise AND and logical NOT is suspicious. > > Fixed by this Coccinelle script: > // From http://article.gmane.org/gmane.linux.kernel/646367 > @@ expression E1,E2; @@ > ( > !E1 & !E2 > | > - !E1 & E2 > + !(E1 & E2) > ) > > Signed-off-by: Blue Swirl > --- > > Maybe the middle hunk should be fixed this way instead: > - } else if ((rw == 1) & !matching->d) { > + } else if ((rw == 1) && !matching->d) { > > --- > hw/etraxfs_eth.c | 2 +- > target-sh4/helper.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c > index b897c9c..ade96f1 100644 > --- a/hw/etraxfs_eth.c > +++ b/hw/etraxfs_eth.c > @@ -464,7 +464,7 @@ static int eth_match_groupaddr(struct fs_eth *eth, > const unsigned char *sa) > > /* First bit on the wire of a MAC address signals multicast or > physical address. */ > - if (!m_individual && !sa[0] & 1) > + if (!m_individual && !(sa[0] & 1)) > return 0; Yep, the etrax part is a bug and your patch looks OK to me. Thanks Acked-by: Edgar E. Iglesias