Skip to content

Commit

Permalink
mn10300: define __fls
Browse files Browse the repository at this point in the history
Like fls, but can't be handed 0 and returns the bit number.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Jan 3, 2009
1 parent 16a2062 commit 5c134da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/asm-mn10300/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ int fls(int x)
return (x != 0) ? __ilog2_u32(x) + 1 : 0;
}

/**
* __fls - find last (most-significant) set bit in a long word
* @word: the word to search
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static inline unsigned long __fls(unsigned long word)
{
return __ilog2_u32(word);
}

/**
* ffs - find first bit set
* @x: the word to search
Expand Down

0 comments on commit 5c134da

Please sign in to comment.