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

From: Jeremy Fitzhardinge
Date: Sun Dec 20 2009 - 00:18:35 EST


On 12/19/2009 06:34 AM, Frederic Weisbecker wrote:
Yeah but we need it from the CPP level.
We include such code located in kernel headers:

static __always_inline unsigned long __fls(unsigned long word)
{
int num = BITS_PER_LONG - 1;

#if BITS_PER_LONG == 64
if (!(word& (~0ul<< 32))) {
num -= 32;
word<<= 32;
}
#endif
if (!(word& (~0ul<< (BITS_PER_LONG-16)))) {
num -= 16;
word<<= 16;
}


And sizeof() is not defined :)

You can use if() with a constant expression instead of #if.

J
--
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/