mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Speed up dm_bit_get_next with ffs().
This commit is contained in:
parent
1569059b2b
commit
803380c203
@ -1,5 +1,6 @@
|
||||
Version 1.02.47 -
|
||||
=================================
|
||||
Speed up dm_bit_get_next with ffs().
|
||||
|
||||
Version 1.02.46 - 14th April 2010
|
||||
=================================
|
||||
|
@ -52,18 +52,11 @@ void dm_bit_union(dm_bitset_t out, dm_bitset_t in1, dm_bitset_t in2)
|
||||
out[i] = in1[i] | in2[i];
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: slow
|
||||
*/
|
||||
static inline int _test_word(uint32_t test, int bit)
|
||||
static int _test_word(uint32_t test, int bit)
|
||||
{
|
||||
while (bit < (int) DM_BITS_PER_INT) {
|
||||
if (test & (0x1 << bit))
|
||||
return bit;
|
||||
bit++;
|
||||
}
|
||||
int next_set_bit;
|
||||
|
||||
return -1;
|
||||
return ((next_set_bit = ffs(test >> bit)) ? next_set_bit + bit - 1 : -1);
|
||||
}
|
||||
|
||||
int dm_bit_get_next(dm_bitset_t bs, int last_bit)
|
||||
|
Loading…
Reference in New Issue
Block a user