mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
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: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
625fbb3f97
commit
b2ec837f72
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user