From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by sourceware.org (Postfix) with ESMTPS id E8991385AC1B for ; Mon, 5 Sep 2022 18:11:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8991385AC1B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=otheo.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=otheo.eu Received: (Authenticated sender: #01#@otheo.eu) by mail.gandi.net (Postfix) with ESMTPSA id BEDF5200004 for ; Mon, 5 Sep 2022 18:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=otheo.eu; s=gm1; t=1662401498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qlb0PRJUaoJ4ia8IqdZIeRx6ZY/SExfYKr/KNq0A/Jc=; b=TNemGr0Ni/8aPIoRS589F8lpPcJtnWAG3LRbCflpINkOjVdINjN94RLIHkp39weeytMJHq GtxhiHe5Eq079RQXaHNDsHpwI8iSQBHMf9NPfvGEOclEE+eegVqsFwQXOj4Hdg9YqwtK22 9ZdN4LUbcLjMVIWdprCY8LaBUYXrQHIT2dPLtx7qNxFB4JMGelPiHs0POdYrsUIMLGdLmk edQf0qiquDThD5BUpvCOnyCR5pEfQOG8HpJrUd/TzctBCeYqwOQoXvKpxFIeGxLObopGFd 614Va1x9x7KxsiPik7k2Ipfb01TusL0uX66jrLYgM+FR0z3WDRUUQ1aVttzERA== Date: Mon, 5 Sep 2022 20:10:27 +0200 From: Javier Pello To: libc-alpha@sourceware.org Subject: [PATCH 2/4] elf: Simplify hwcaps masked value bit counting Message-Id: <20220905201027.0338ebf933cfd767cfa83da3@otheo.eu> In-Reply-To: <20220905200652.d69204581d15c64647da5cd2@otheo.eu> References: <20220905200652.d69204581d15c64647da5cd2@otheo.eu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Use a simpler way to count the number of bits set in the masked value in _dl_important_hwcaps. Signed-off-by: Javier Pello --- elf/dl-hwcaps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c index 92eb5379..8f11a18f 100644 --- a/elf/dl-hwcaps.c +++ b/elf/dl-hwcaps.c @@ -197,8 +197,8 @@ _dl_important_hwcaps (const char *glibc_hwcaps_prepend, + hwcaps_counts.total_length); /* Count the number of bits set in the masked value. */ - for (n = 0; (~((1ULL << n) - 1) & masked) != 0; ++n) - if ((masked & (1ULL << n)) != 0) + for (uint64_t mm = masked; mm != 0; mm >>= 1) + if ((mm & 1ULL) != 0) ++cnt; /* For TLS enabled builds always add 'tls'. */ -- 2.36.0