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] [day] [month] [year] [list]
Message-ID: <875zszndwd.fsf@intel.com>
Date:   Mon, 04 Mar 2019 12:16:02 +0200
From:   Jani Nikula <jani.nikula@...el.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org,
        Chris Wilson <chris@...is-wilson.co.uk>
Subject: Re: [PATCH] log2: make is_power_of_2() integer constant expression when possible

On Fri, 01 Mar 2019, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Fri,  1 Mar 2019 14:52:07 +0200 Jani Nikula <jani.nikula@...el.com> wrote:
>
>> While is_power_of_2() is an inline function and likely gets optimized
>> for compile time constant arguments, it still doesn't produce an integer
>> constant expression that could be used in, say, static data
>> initialization or case labels.
>
> hm, what code wants to do these things?
>
>> Make is_power_of_2() an integer constant expression when possible,
>> otherwise using the inline function to avoid multiple evaluation of the
>> parameter.
>
> Spose so.  But I fear that some gcc versions will get it right and
> others will mess it up.  While this patch is under test I think it
> would be best to also have at least one or two callsites which actually
> use the compile-time evaluation feature.  Possible?

I have some drm/i915 patches that have a local compile-time version of
IS_POWER_OF_2(). It'll take a while before they hit Linus' master. This
can wait.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ