lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9682c6f3-bc48-9ad1-4011-dfe1532e7491@rasmusvillemoes.dk>
Date:   Wed, 11 May 2022 12:59:13 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Yury Norov <yury.norov@...il.com>,
        David Laight <David.Laight@...lab.com>
Cc:     'Alexei Starovoitov' <alexei.starovoitov@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joe Perches <joe@...ches.com>,
        Julia Lawall <Julia.Lawall@...ia.fr>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Nicholas Piggin <npiggin@...il.com>,
        Nicolas Palix <nicolas.palix@...g.fr>,
        Peter Zijlstra <peterz@...radead.org>,
        Matti Vaittinen <Matti.Vaittinen@...rohmeurope.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Chris Zankel <chris@...kel.net>,
        Christophe Leroy <christophe.leroy@...roup.eu>,
        "Eric W . Biederman" <ebiederm@...ssion.com>,
        Kumar Kartikeya Dwivedi <memxor@...il.com>,
        Max Filippov <jcmvbkbc@...il.com>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        "linux-xtensa@...ux-xtensa.org" <linux-xtensa@...ux-xtensa.org>
Subject: Re: [PATCH 08/22] bitops: introduce MANY_BITS() macro

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ