From nobody Tue Feb 10 13:16:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149459017484838.28637134748794; Fri, 12 May 2017 04:56:14 -0700 (PDT) Received: from localhost ([::1]:53068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d99B6-0006eQ-H3 for importer@patchew.org; Fri, 12 May 2017 07:56:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d996p-0002tG-Ig for qemu-devel@nongnu.org; Fri, 12 May 2017 07:51:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d996o-00056R-JM for qemu-devel@nongnu.org; Fri, 12 May 2017 07:51:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7915) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d996o-00055x-E6 for qemu-devel@nongnu.org; Fri, 12 May 2017 07:51:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49219C05AA42; Fri, 12 May 2017 11:51:44 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-243.ams2.redhat.com [10.36.116.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1D054DA83; Fri, 12 May 2017 11:51:43 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 9EC6480F99; Fri, 12 May 2017 13:51:39 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 49219C05AA42 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 49219C05AA42 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 13:51:35 +0200 Message-Id: <20170512115135.17379-11-kraxel@redhat.com> In-Reply-To: <20170512115135.17379-1-kraxel@redhat.com> References: <20170512115135.17379-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 12 May 2017 11:51:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/10] vnc: replace hweight_long() with ctpopl() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater ctpopl() has a better implementation than hweight_long() and ui/vnc.c being the last user of hweight_long(), we can simply remove it. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Peter Maydell Message-id: 1489415605-13105-1-git-send-email-clg@kaod.org Signed-off-by: Gerd Hoffmann --- include/qemu/bitops.h | 10 ---------- ui/vnc.c | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 1881284cb5..3f0926cf40 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -201,16 +201,6 @@ static inline unsigned long find_first_zero_bit(const = unsigned long *addr, return find_next_zero_bit(addr, size, 0); } =20 -static inline unsigned long hweight_long(unsigned long w) -{ - unsigned long count; - - for (count =3D 0; w; w >>=3D 1) { - count +=3D w & 1; - } - return count; -} - /** * rol8 - rotate an 8-bit value left * @word: value to rotate diff --git a/ui/vnc.c b/ui/vnc.c index 601f9ec539..47b49c7318 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2061,15 +2061,15 @@ static void set_pixel_format(VncState *vs, int bits= _per_pixel, } =20 vs->client_pf.rmax =3D red_max ? red_max : 0xFF; - vs->client_pf.rbits =3D hweight_long(red_max); + vs->client_pf.rbits =3D ctpopl(red_max); vs->client_pf.rshift =3D red_shift; vs->client_pf.rmask =3D red_max << red_shift; vs->client_pf.gmax =3D green_max ? green_max : 0xFF; - vs->client_pf.gbits =3D hweight_long(green_max); + vs->client_pf.gbits =3D ctpopl(green_max); vs->client_pf.gshift =3D green_shift; vs->client_pf.gmask =3D green_max << green_shift; vs->client_pf.bmax =3D blue_max ? blue_max : 0xFF; - vs->client_pf.bbits =3D hweight_long(blue_max); + vs->client_pf.bbits =3D ctpopl(blue_max); vs->client_pf.bshift =3D blue_shift; vs->client_pf.bmask =3D blue_max << blue_shift; vs->client_pf.bits_per_pixel =3D bits_per_pixel; --=20 2.9.3