Re: [PATCH] perf tools: Prevent from BITS_PER_LONG redefinition

From: Frederic Weisbecker
Date: Sat Jan 02 2010 - 12:02:09 EST


On Thu, Dec 31, 2009 at 10:09:43PM +1100, Jeremy Fitzhardinge wrote:
> On 12/31/2009 08:45 AM, Frederic Weisbecker wrote:
>>> You can use if() with a constant expression instead of #if.
>>>
>>
>>
>> I did not write this code. But yes you're right, although I
>> think CPP is more suitable here because fls() can be called
>> from fastpath and this conditional build makes one check less
>> and lesser i-cache footprint.
>>
>
> Constant if()s are removed at compile time, so there should be no
> runtime overhead. Constant if()s are generally preferable to #if
> because the compile will statically check the other code branch, even if
> it never gets executed, which helps prevent it from rotting.



Good point! I did not think about compile time optimizations.
I'll try that then. Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/