lkml.org 
[lkml]   [2019]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] log2: make is_power_of_2() integer constant expression when possible
On Fri,  1 Mar 2019 14:52:07 +0200 Jani Nikula <jani.nikula@intel.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?

\
 
 \ /
  Last update: 2019-03-01 21:28    [W:0.060 / U:1.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site