From patchwork Tue Jun 3 23:41:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 31342 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6021203AC for ; Tue, 3 Jun 2014 23:41:35 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf38945404iec.10 for ; Tue, 03 Jun 2014 16:41:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Zv51GmGFqojV1Cn4nqXhG3aL7KPV8zQ6hvnrJqCrki0=; b=SSyzfGm/pbvg6GtK+CjwHpNEDEoyvGCPAt879oBWjG79icQRanj7ngkC3Gc8PkPBfj DfGyTAu96vYJSf3h+QdlLK6WYu1ETsTfl45u7WtNO/7z1qSSf4ySH2i5gnxIVPBDaLfo HzLOPX5R2z38ZAAdX0C4X5v/VcHGvDGGco82pI31xETCieMdZil0kgAugnmsRNI5X06K MiaaCeGZxWbjTTL3TFiUeom2jfrzi4GTjnc+ecSQMEwvGAQwlBMEP2zx9FEqVrxPRfw5 piKKd/nxG12wVq31bV2jSc7XRjwPu5I4MVnx9tJNOihBuPvWIekkmWSYwCMdDLWCiQrr DHCw== X-Gm-Message-State: ALoCoQmDLyjV4nsFCiMdPuU2rjXRXHVP4wVjegD9baXtQPrUuwfP83AzGafG9H+zeX7olJFRIzBh X-Received: by 10.50.239.196 with SMTP id vu4mr11137114igc.8.1401838895180; Tue, 03 Jun 2014 16:41:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.81 with SMTP id b75ls2781736qgd.34.gmail; Tue, 03 Jun 2014 16:41:35 -0700 (PDT) X-Received: by 10.52.100.3 with SMTP id eu3mr4393558vdb.68.1401838895054; Tue, 03 Jun 2014 16:41:35 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id pm3si481578vec.75.2014.06.03.16.41.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Jun 2014 16:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id sa20so7824177veb.41 for ; Tue, 03 Jun 2014 16:41:35 -0700 (PDT) X-Received: by 10.52.138.232 with SMTP id qt8mr9647189vdb.44.1401838894858; Tue, 03 Jun 2014 16:41:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp4148vcb; Tue, 3 Jun 2014 16:41:34 -0700 (PDT) X-Received: by 10.180.76.179 with SMTP id l19mr37089250wiw.43.1401838893841; Tue, 03 Jun 2014 16:41:33 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id fm4si4903966wib.68.2014.06.03.16.41.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Jun 2014 16:41:33 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WryKi-0000Xu-HM; Wed, 04 Jun 2014 00:41:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Martin Husemann Subject: [PATCH] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent Date: Wed, 4 Jun 2014 00:41:32 +0100 Message-Id: <1401838892-2073-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The function popcountl() in hbitmap.c is effectively a reimplementation of what host-utils.h provides as ctpopl(). Use ctpopl() directly; this fixes a failure to compile on NetBSD (whose strings.h erroneously exposes a system popcountl() which clashes with this one). Signed-off-by: Peter Maydell Reported-by: Martin Husemann Reviewed-by: Paolo Bonzini --- We haven't compiled on NetBSD for over a year... util/hbitmap.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/util/hbitmap.c b/util/hbitmap.c index d936831..b3060e6 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -92,11 +92,6 @@ struct HBitmap { unsigned long *levels[HBITMAP_LEVELS]; }; -static inline int popcountl(unsigned long l) -{ - return BITS_PER_LONG == 32 ? ctpop32(l) : ctpop64(l); -} - /* Advance hbi to the next nonzero word and return it. hbi->pos * is updated. Returns zero if we reach the end of the bitmap. */ @@ -200,14 +195,14 @@ static uint64_t hb_count_between(HBitmap *hb, uint64_t start, uint64_t last) if (pos >= (end >> BITS_PER_LEVEL)) { break; } - count += popcountl(cur); + count += ctpopl(cur); } if (pos == (end >> BITS_PER_LEVEL)) { /* Drop bits representing the END-th and subsequent items. */ int bit = end & (BITS_PER_LONG - 1); cur &= (1UL << bit) - 1; - count += popcountl(cur); + count += ctpopl(cur); } return count;