Commit 03598ea5 authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

bitops: use a gcc builtin function instead of our __ffs

Our __ffs implementation is straightforward and non-optimal,
__builtin_ffsl should be faster.
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 825ac610
......@@ -57,17 +57,7 @@ static inline void clear_bit(int nr, volatile unsigned long *addr)
*/
static inline unsigned long __ffs(unsigned long word)
{
int p = 0;
for (; p < 8*sizeof(word); ++p) {
if (word & 1) {
break;
}
word >>= 1;
}
return p;
return __builtin_ffsl(word) - 1;
}
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment