mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
kvm: x86: simplify kvm_vector_to_index()
Use find_nth_bit() and make the function almost a one-liner. Signed-off-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
1f0654dc75
commit
cc63f918a2
|
|
@ -1064,16 +1064,9 @@ EXPORT_SYMBOL_GPL(kvm_apic_match_dest);
|
|||
int kvm_vector_to_index(u32 vector, u32 dest_vcpus,
|
||||
const unsigned long *bitmap, u32 bitmap_size)
|
||||
{
|
||||
u32 mod;
|
||||
int i, idx = -1;
|
||||
|
||||
mod = vector % dest_vcpus;
|
||||
|
||||
for (i = 0; i <= mod; i++) {
|
||||
idx = find_next_bit(bitmap, bitmap_size, idx + 1);
|
||||
BUG_ON(idx == bitmap_size);
|
||||
}
|
||||
int idx = find_nth_bit(bitmap, bitmap_size, vector % dest_vcpus);
|
||||
|
||||
BUG_ON(idx >= bitmap_size);
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user