lkml.org 
[lkml]   [2012]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH v3 26/31] arm64: Miscellaneous library functions
    Date
    On Friday 07 September 2012, Catalin Marinas wrote:

    > +/*
    > + * Use compiler builtins for simple inline operations.
    > + */
    > +static inline unsigned long __ffs(unsigned long word)
    > +{
    > + return __builtin_ffsl(word) - 1;
    > +}
    > +
    > +static inline int ffs(int x)
    > +{
    > + return __builtin_ffs(x);
    > +}
    > +
    > +static inline unsigned long __fls(unsigned long word)
    > +{
    > + return BITS_PER_LONG - 1 - __builtin_clzl(word);
    > +}
    > +
    > +static inline int fls(int x)
    > +{
    > + return x ? sizeof(x) * BITS_PER_BYTE - __builtin_clz(x) : 0;
    > +}

    Still waiting for the generic version of these.

    Arnd


    \
     
     \ /
      Last update: 2012-09-07 22:42    [W:4.026 / U:0.636 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site