Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6844735iob; Wed, 11 May 2022 06:37:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziTutAD64tL+jqzgKLg9tLmi27oh+o9JGUCFx5CcypVwMC+zpW87px874z8mmHPmXgm2T7 X-Received: by 2002:a17:907:72ca:b0:6f9:8675:6a2a with SMTP id du10-20020a17090772ca00b006f986756a2amr16945832ejc.98.1652276278231; Wed, 11 May 2022 06:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652276278; cv=none; d=google.com; s=arc-20160816; b=nYqxcYOhfx/3V8Yy1OQK6dSEXPacZpmsXRjLtxGB2KuUuvq9BZftF0dQzAVnI92C8p cevuvXsZruxJhnaUom4EnmPJsPAS3nW+gjS3VK/8XMh/pm0pZGCq5ff3JFpO22vUEjbF oqo6Z/RzuffGc5lgrozibkudkl1rIIe0Ptp9idt/T2gY7FZZ8nVdsd0oEyLKNqhMIG6u E17/wTkN8iSAm1C29YLpReupvX8vvWBt2CL3L3xfzezRTJucZOocB4xRGWmJNelaCDXP ttNNohHfLuox1LzLOHqz5XpMVGAmgOSYv41WYtFtDNlF6Cc0NPCt0dzUg7TAFxBUoM3A 9zMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vEImwAt+hQscgP/wRyfuHbE14MDXXeZYgodcfZ9QQ08=; b=wEQ0xLcUFYRmauckc2B4AoB6iSDrSx7/2ygKbeNMP4Sq23L74We92s0fD2HlHhx4kc waTO0ADS9IpxXjzYThPnukUo93ajrPm+8wb7cdn0v5O/gZ3346aB+QZ2I8T7Den3Wrz9 x9jAaAgFSIKvyqXdwry43ObxJi2q2w3DhXZpONZNIR/uobEH+GLfMYeK6Exo9UBJkW1d QhHpUKPLk4Retf4EQp+WJ24aC7D4ytoCn5C2hu0lb7TJe4DqCCMpvxQF7GuOUqPhcBqX ywoEr45dZoILBNj9cxdoozL/yXZeB0UfBvpra7WYdLGgVwe2BkLVOPYyT5hsv7hHxxU4 /JIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="f/G2nhb/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b006f39901edd6si2558238ejc.400.2022.05.11.06.37.31; Wed, 11 May 2022 06:37:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="f/G2nhb/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbiEKK7V (ORCPT + 99 others); Wed, 11 May 2022 06:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbiEKK7T (ORCPT ); Wed, 11 May 2022 06:59:19 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE9B16C5EA for ; Wed, 11 May 2022 03:59:17 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id m23so2141755ljc.0 for ; Wed, 11 May 2022 03:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=vEImwAt+hQscgP/wRyfuHbE14MDXXeZYgodcfZ9QQ08=; b=f/G2nhb/TigMYF4+t+iiwPFSHTmuzT1r3R4TfSbvMZDiC2MHQ7Kq/E+NMTloS0RxN7 afcffjTDe8hoNb5eC6Us0Rd6qMDpd3O6BwuMgeSS48slcojiPOaZ1uAiPs+QF2mhdlEN OF85P1xmLCIuuHfNPWrm07DxTXujLldNF7pS4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=vEImwAt+hQscgP/wRyfuHbE14MDXXeZYgodcfZ9QQ08=; b=VzeNxk0C7L1tdaIxCFutpwJZWkKwfDiGJG9qZOaTj9Ig4gv2vtvkYUUB9L6XqnOMLq 5ts5GRNlxs3I4mUkDan+zSnuJ/X3ZwpgHFu3kF1dpqTUetl8Ng6XBGtsGZ0KMXOMyn7Y AgCNTGcd15ic+W0yBukbpYNuyDl6CzQ6k1zbwn2zxpSjHL5zQPT55qcoak7c5MIrl0+j xd8vsterFk2fXHsmOmotPrNj3MMUzqKCL7CBonJvVrrlMMxgi9DP9bWo1ndB/LxuNVwD oy+F3sMCHEApFpjl5+f4j+kLLp0tE6gEOLFkAgwc/v9Y7s+1li+eg7g7fMeF4slwYZ9C gykQ== X-Gm-Message-State: AOAM531hDkCtLfDV2AlRTZUON0t9uGAKmZdgbgJqex/vIgc/NkvactCQ tLJjQxyTvPIP1E5Y2mfNEjrP8w== X-Received: by 2002:a2e:5305:0:b0:250:9bd1:af51 with SMTP id h5-20020a2e5305000000b002509bd1af51mr16885842ljb.383.1652266756022; Wed, 11 May 2022 03:59:16 -0700 (PDT) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id m22-20020a05651202f600b0047255d211c0sm223017lfq.239.2022.05.11.03.59.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 May 2022 03:59:15 -0700 (PDT) Message-ID: <9682c6f3-bc48-9ad1-4011-dfe1532e7491@rasmusvillemoes.dk> Date: Wed, 11 May 2022 12:59:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 08/22] bitops: introduce MANY_BITS() macro Content-Language: en-US To: Yury Norov , David Laight Cc: 'Alexei Starovoitov' , Andy Shevchenko , Greg Kroah-Hartman , Joe Perches , Julia Lawall , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Nicholas Piggin , Nicolas Palix , Peter Zijlstra , Matti Vaittinen , LKML , Alexei Starovoitov , Andrew Morton , Chris Zankel , Christophe Leroy , "Eric W . Biederman" , Kumar Kartikeya Dwivedi , Max Filippov , =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , "linux-xtensa@linux-xtensa.org" References: <20220510154750.212913-1-yury.norov@gmail.com> <20220510154750.212913-9-yury.norov@gmail.com> <3be064fe804845e4aeaca8b1d45ddf0a@AcuMS.aculab.com> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/05/2022 21.11, Yury Norov wrote: > Another thing is that despite __attribute__(const), gcc sometimes doesn't > recognize it as constant expression, An ICE, Integer Constant Expression, is a C language thing. __attribute__(const) has nothing to do with that, and no use of that attribute is ever gonna convince gcc to treat an expression containing a function call as an ICE [C++ is of course a whole different story]. The __attribute__(const) on a static inline function is utterly pointless, the compiler can certainly see for itself that the function has no side effects and that the expression can be CSE'ed. All that aside, please drop that MANY_BITS thing. It will not make any code any easier to read (MANY, is that four or five? or is it "more than half the bit width"?). The n&(n-1) pattern is a well-known idiom, I expect anybody hacking on an OS kernel to recognize Rasmus