From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by sourceware.org (Postfix) with ESMTPS id 677843857016 for ; Mon, 5 Sep 2022 18:13:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 677843857016 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 6145920004 for ; Mon, 5 Sep 2022 18:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=otheo.eu; s=gm1; t=1662401607; 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=h+aPHdeqjYygX4KJAgiQEwEJMdEA4xByho6yMZtrvz0=; b=Go92cFgOT0/675q2cSPhXEv9volIOuNiHBRYC/gdifo40EkhtGM7KXtfSoAJ1TPSmUWydd ejnZoR1WdFc7Ux8NN9TzDN9QnAEsSSwvCo4wAdnYyYgpcyc91H88IIer8O7GPq4xALRRcw C6k7Dgnby8sAF1AV95sKGw/LFI1naD4b8q1+PAU/VsY3zm9oGc+Ol0A4VfRaKr4Ao53ccn udkFqiDPPYDrNgcE0ewzYbfdou7ambMp802iA8CnDUMtQwh4nTCOYDPUsI8ZWeM11f9uwv aSlP5cRGN2yNNHvIb3KU8TN+Gblcn16zJjNorZzv9NUXU6y9L/wUI8qMqXAsaA== Date: Mon, 5 Sep 2022 20:12:17 +0200 From: Javier Pello To: libc-alpha@sourceware.org Subject: [PATCH 3/4] elf: Remove unneeded conditional in _dl_important_hwcaps Message-Id: <20220905201217.053f589b1c4bb7a2be6d9682@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.8 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,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: _dl_important_hwcaps had a special case for building the power set strings when cnt == 2, but the generic case does exactly the same. Signed-off-by: Javier Pello --- elf/dl-hwcaps.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c index 8f11a18f..b248f74b 100644 --- a/elf/dl-hwcaps.c +++ b/elf/dl-hwcaps.c @@ -307,31 +307,23 @@ _dl_important_hwcaps (const char *glibc_hwcaps_prepend, result[1].str = result[0].str = cp; #define add(idx) \ cp = __mempcpy (__mempcpy (cp, temp[idx].str, temp[idx].len), "/", 1); - if (cnt == 2) - { - add (1); - add (0); - } - else + n = 1 << (cnt - 1); + do { - n = 1 << (cnt - 1); - do - { - n -= 2; + n -= 2; - /* We always add the last string. */ - add (cnt - 1); + /* We always add the last string. */ + add (cnt - 1); - /* Add the strings which have the bit set in N. */ - for (m = cnt - 2; m > 0; --m) - if ((n & (1 << m)) != 0) - add (m); + /* Add the strings which have the bit set in N. */ + for (m = cnt - 2; m > 0; --m) + if ((n & (1 << m)) != 0) + add (m); - /* Always add the first string. */ - add (0); - } - while (n != 0); + /* Always add the first string. */ + add (0); } + while (n != 0); #undef add /* Now we are ready to install the string pointers and length. */ -- 2.36.0