lkml.org 
[lkml]   [2009]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] perf tools: Prevent from BITS_PER_LONG redefinition
    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


    \
     
     \ /
      Last update: 2009-12-20 06:13    [W:0.018 / U:6.396 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site