From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75075 invoked by alias); 11 May 2017 07:53:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 75054 invoked by uid 89); 11 May 2017 07:53:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 May 2017 07:53:17 +0000 Received: from ball (unknown [IPv6:2620:101:80f2:224:56ee:75ff:fe52:afb9]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 44E86C06A; Thu, 11 May 2017 07:53:17 +0000 (UTC) Date: Thu, 11 May 2017 08:01:00 -0000 From: Trevor Saunders To: tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Re: [PATCH 02/13] improve bitmap / sbitmap compatability of bitmap_set_bit Message-ID: <20170511075313.n66fsg6rno4arbo5@ball> References: <20170509205242.2237-1-tbsaunde+gcc@tbsaunde.org> <20170509205242.2237-3-tbsaunde+gcc@tbsaunde.org> <87wp9pqkhq.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wp9pqkhq.fsf@linaro.org> User-Agent: NeoMutt/20170306 (1.8.0) X-SW-Source: 2017-05/txt/msg00856.txt.bz2 On Wed, May 10, 2017 at 07:44:17AM +0100, Richard Sandiford wrote: > tbsaunde+gcc@tbsaunde.org writes: > > From: Trevor Saunders > > > > This make the sbitmap version return true if the bit was previously > > unset to make it similar to the bitmap version. > > > > gcc/ChangeLog: > > > > 2017-05-09 Trevor Saunders > > > > * sbitmap.h (bitmap_set_bit): Return bool similar to bitmap > > version of this function. > > --- > > gcc/sbitmap.h | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h > > index cba0452cdb9..d4e3177d495 100644 > > --- a/gcc/sbitmap.h > > +++ b/gcc/sbitmap.h > > @@ -108,11 +108,14 @@ bitmap_bit_p (const_sbitmap map, int bitno) > > > > /* Set bit number BITNO in the sbitmap MAP. */ > > > > -static inline void > > +static inline bool > > bitmap_set_bit (sbitmap map, int bitno) > > { > > - map->elms[bitno / SBITMAP_ELT_BITS] > > - |= (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS; > > + SBITMAP_ELT_TYPE &word = map->elms[bitno / SBITMAP_ELT_BITS]; > > + SBITMAP_ELT_TYPE mask = (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS; > > + bool ret = (word & mask) == 0; > > + word |= mask; > > + return ret; > > } > > Indentation looks off (mabye it's a mailer thing?). Think the function > comment should be updated too -- personally I can never remember whether > true means "I just set it" or "it was already set" :-) Sure, I can handle that. > What's the current position on the use of references? IMO a pointer > is clearer here. Well, I generally think non const references aren't a great idea, so I'm not really sure why I used one here. Anyway not a big deal so happy to change that. thanks Trev > > Thanks, > Richard