File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ static inline cpuid_t vm_translate_to_pcpuid(struct vm* vm, vcpuid_t vcpuid)
150150static inline vcpuid_t vm_translate_to_vcpuid (struct vm * vm , cpuid_t pcpuid )
151151{
152152 if (vm -> cpus & (1UL << pcpuid )) {
153- return (cpuid_t )bit_count (vm -> cpus & BIT_MASK ( 0 , pcpuid ));
153+ return (cpuid_t )bit_count (vm -> cpus & (( 1UL << pcpuid ) - 1UL ));
154154 } else {
155155 return INVALID_CPUID ;
156156 }
Original file line number Diff line number Diff line change 99#include <bao.h>
1010
1111/**
12+ * The bit mask macros support LEN within [1, BITS_PER_LONG]. LEN == 0 is not supported.
1213 * The extra shift is because both arm and riscv logical shift instructions support a maximum of
13- * machine word length minus one bit shits . This covers the corner case of runtime full machine
14+ * machine word length minus one bit shifts . This covers the corner case of runtime full machine
1415 * word length masks with the cost of an extra shift instruction. For static masks, there should be
1516 * no extra costs.
1617 */
You can’t perform that action at this time.
0 commit comments