X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/ec9466ff2e50213c8318ffdd7003f345278ab795..1d32c26f28d6e25f447b8ba40440c7d228ed4006:/target-i386/topology.h diff --git a/target-i386/topology.h b/target-i386/topology.h index 24ed525453..07a6c5fb55 100644 --- a/target-i386/topology.h +++ b/target-i386/topology.h @@ -52,10 +52,8 @@ typedef uint32_t apic_id_t; static unsigned apicid_bitwidth_for_count(unsigned count) { g_assert(count >= 1); - if (count == 1) { - return 0; - } - return bitops_flsl(count - 1) + 1; + count -= 1; + return count ? 32 - clz32(count) : 0; } /* Bit width of the SMT_ID (thread ID) field on the APIC ID