提交 ee38e514 编写于 作者: R Rusty Russell

frv: define __fls

Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 0999769e
......@@ -339,6 +339,19 @@ int __ffs(unsigned long x)
return 31 - bit;
}
/**
* __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)
{
unsigned long bit;
asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word));
return bit;
}
/*
* special slimline version of fls() for calculating ilog2_u32()
* - note: no protection against n == 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册