summaryrefslogtreecommitdiffstats
path: root/target-i386/topology.h
diff options
context:
space:
mode:
authorRichard Henderson2013-02-14 02:47:40 +0100
committerBlue Swirl2013-02-16 12:12:29 +0100
commit14e534265aad0796690a5aea429f5bd2877ccff0 (patch)
treef737f58d1007171c24c9cdb696d60bbd2f7e298b /target-i386/topology.h
parentbitops: Write bitops_flsl in terms of clzl (diff)
downloadqemu-14e534265aad0796690a5aea429f5bd2877ccff0.tar.gz
qemu-14e534265aad0796690a5aea429f5bd2877ccff0.tar.xz
qemu-14e534265aad0796690a5aea429f5bd2877ccff0.zip
target-i386: Inline bitops_flsl
Use clz32 directly. Which makes slightly more sense given that the input is type "int" and not type "long". Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-i386/topology.h')
-rw-r--r--target-i386/topology.h6
1 files changed, 2 insertions, 4 deletions
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