From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23512 invoked by alias); 15 Oct 2014 15:00:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23503 invoked by uid 89); 15 Oct 2014 15:00:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 15 Oct 2014 15:00:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id ED3DF116132; Wed, 15 Oct 2014 11:00:49 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IOumkFV+5M7O; Wed, 15 Oct 2014 11:00:49 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B513B116130; Wed, 15 Oct 2014 11:00:49 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 0ACD440DC2; Wed, 15 Oct 2014 08:00:49 -0700 (PDT) Date: Wed, 15 Oct 2014 15:00:00 -0000 From: Joel Brobecker To: Chen Gang Cc: Andreas Schwab , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/hppa-tdep.c: Fix a logical typo bug found by compiler warning Message-ID: <20141015150049.GD25846@adacore.com> References: <543D93DD.5000906@gmail.com> <87d29uxrvg.fsf@igel.home> <543D98F3.2030009@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <543D98F3.2030009@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-10/txt/msg00398.txt.bz2 > On 10/15/2014 05:29 AM, Andreas Schwab wrote: > > Chen Gang writes: > > > >> && (((inst >> 6) & 0xf) == 0x8 > >> - || (inst >> 6) & 0xf) == 0x9)) > >> + || ((inst >> 6) & 0xf) == 0x9))) > > > > ((inst >> 6) & 0xe) == 8 > > > > Andreas. > > > > I guess, your fixing may like below, which will be a different logical > working flow. I think Andreas is telling you that... ((inst >> 6) & 0xf) == 0x8 || ((inst >> 6) & 0xf) == 0x9 ... is logically equivalent to ... ((inst >> 6) & 0xe) == 8 In other word, if it does not matter if bit 7 is set or not (the difference between 0x8 and 0x9) all you have to do is mask it. That way, you test both conditions with one comparison instead of 2. -- Joel