1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Speed up dm_bit_get_next with ffs().

This commit is contained in:
Alasdair Kergon 2010-04-19 17:17:55 +00:00
parent 5e3285ef49
commit 72ab7270e0
2 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.47 - Version 1.02.47 -
================================= =================================
Speed up dm_bit_get_next with ffs().
Version 1.02.46 - 14th April 2010 Version 1.02.46 - 14th April 2010
================================= =================================

View File

@ -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]; out[i] = in1[i] | in2[i];
} }
/* static int _test_word(uint32_t test, int bit)
* FIXME: slow
*/
static inline int _test_word(uint32_t test, int bit)
{ {
while (bit < (int) DM_BITS_PER_INT) { int next_set_bit;
if (test & (0x1 << bit))
return bit;
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) int dm_bit_get_next(dm_bitset_t bs, int last_bit)