diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2010-07-08 12:16:16 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2010-07-08 12:16:16 +0000 |
commit | 981adf483791d6145cc028bf18dbdb23a88eaaac (patch) | |
tree | e51014215d90ef922a15be80a3534bcdefee9526 /libdm/datastruct | |
parent | 71082be43a893b6edc2a8a9dba6e45c11020e11f (diff) | |
download | lvm2-981adf483791d6145cc028bf18dbdb23a88eaaac.tar.gz lvm2-981adf483791d6145cc028bf18dbdb23a88eaaac.tar.xz lvm2-981adf483791d6145cc028bf18dbdb23a88eaaac.zip |
Minor optimalization of _test_word.
Skip ffs() if (test >> bit) is 0.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/bitset.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c index 9b8aff93..563f684e 100644 --- a/libdm/datastruct/bitset.c +++ b/libdm/datastruct/bitset.c @@ -69,9 +69,9 @@ void dm_bit_union(dm_bitset_t out, dm_bitset_t in1, dm_bitset_t in2) static int _test_word(uint32_t test, int bit) { - int next_set_bit; + uint32_t tb = test >> bit; - return ((next_set_bit = ffs(test >> bit)) ? next_set_bit + bit - 1 : -1); + return (tb ? ffs(tb) + bit - 1 : -1); } int dm_bit_get_next(dm_bitset_t bs, int last_bit) |