From patchwork Wed Jun 11 14:29:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 31772 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B38F2054B for ; Wed, 11 Jun 2014 14:34:41 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf12823970qcx.1 for ; Wed, 11 Jun 2014 07:34:41 -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:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=JAv6c3FjEoTN0KOGUgzElcpob00If5+NU0YGTQnZZaQ=; b=UZeusXUmb3FTpvH7UAWl2QU+H4v6aSpCR3ezLYJyQCdv9kEMNwKk/D1GIa97VKSoRM ZRwF8rzpzHJMl6rYjzXr7dkC8NQQkR70BIaKBOCSwB4eNaatbul/5h01EaUi1B5QJKrg I/Qmeca2RHXlUQGJ2sl/D5z+LMNvqkXrmPpTV0QWX013PmlSKn5uR32abzj3bDLlQ26h Blw2sKf4TYfBJ4mERsH93FZjny0Ns96BNIPTpMrTP0yya/CVpeil4Q1dcz/+WHCciW2V /5VKdghCjw/DY/R+Cgb6I5P3G361KAE0wC0Opykrudk4MbbEAm/dHOA6wk4+yWAkUihK BB9g== X-Gm-Message-State: ALoCoQm6slRjodtQHBcl9+8bN5w+PMPrdYo+4MwkqhClzW7t+X93jtng3Xvcud515GaISL0jXPvU X-Received: by 10.58.160.72 with SMTP id xi8mr3683585veb.15.1402497281082; Wed, 11 Jun 2014 07:34:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.147 with SMTP id 19ls2555819qgp.68.gmail; Wed, 11 Jun 2014 07:34:40 -0700 (PDT) X-Received: by 10.58.76.163 with SMTP id l3mr467989vew.74.1402497280895; Wed, 11 Jun 2014 07:34:40 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id aa6si14287056vec.66.2014.06.11.07.34.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 07:34:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so7065823veb.31 for ; Wed, 11 Jun 2014 07:34:40 -0700 (PDT) X-Received: by 10.52.25.130 with SMTP id c2mr3440325vdg.27.1402497280818; Wed, 11 Jun 2014 07:34:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp308684vcb; Wed, 11 Jun 2014 07:34:40 -0700 (PDT) X-Received: by 10.140.40.81 with SMTP id w75mr21437245qgw.112.1402497279939; Wed, 11 Jun 2014 07:34:39 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f16si9506997qaq.15.2014.06.11.07.34.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 07:34:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:46849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wujbr-0002Uq-Dw for patch@linaro.org; Wed, 11 Jun 2014 10:34:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujXR-0004qG-OT for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WujXP-0008Kj-Sc for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:05 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujXP-0008DN-MV for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:03 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WujXF-00075O-M3; Wed, 11 Jun 2014 15:29:53 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 11 Jun 2014 15:29:40 +0100 Message-Id: <1402496993-27206-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402496993-27206-1-git-send-email-peter.maydell@linaro.org> References: <1402496993-27206-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Blue Swirl Subject: [Qemu-devel] [PULL 02/15] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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). Reported-by: Martin Husemann Reviewed-by: Paolo Bonzini Signed-off-by: Peter Maydell --- 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;