Messages in this thread | | | Date | Sat, 2 Jan 2010 18:01:54 +0100 | From | Frederic Weisbecker <> | Subject | Re: [PATCH] perf tools: Prevent from BITS_PER_LONG redefinition |
| |
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!
| |