From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15754 invoked by alias); 26 Jan 2012 08:27:03 -0000 Received: (qmail 15692 invoked by uid 22791); 26 Jan 2012 08:26:54 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_XF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Jan 2012 08:26:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0Q8QTc7032099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 26 Jan 2012 03:26:30 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0Q7R5JZ012060; Thu, 26 Jan 2012 02:27:05 -0500 Message-ID: <4F210048.3000900@redhat.com> Date: Thu, 26 Jan 2012 09:18:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Mike Frysinger CC: gdb-patches@sourceware.org, Kevin Buettner Subject: Re: [RFC] Add support for the Renesas rl78 architecture References: <20120125165800.5351c291@mesquite.lan> <201201252118.06928.vapier@gentoo.org> In-Reply-To: <201201252118.06928.vapier@gentoo.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2012-01/txt/msg00891.txt.bz2 On 01/26/2012 02:18 AM, Mike Frysinger wrote: > On Wednesday 25 January 2012 18:58:00 Kevin Buettner wrote: >> +/* Return the register address associated with the register specified by >> + REGNO. */ >> +static unsigned long reg_addr (enum sim_rl78_regnum regno) >> +{ >> + if (sim_rl78_bank0_r0_regnum <= regno && regno <= >> sim_rl78_bank0_r7_regnum) >> + return 0xffef8 + (regno - sim_rl78_bank0_r0_regnum); > > the if statements look funny because the operators are reversed. a more > natural (imo) check: > if (regno >= sim_rl78_bank0_r0_regnum && regno <= sim_rl78_bank0_r7_regnum) Funny, I also usually go with Kevin's style. My rationale is that LOWER_RANGE <= N && N <= UPPER_RANGE looks more like the mathematical LOWER_RANGE <= N <= UPPER_RANGE and thus reads more naturally to me. While we're at it, can we put the function name at column 0? :-) -- Pedro Alves