Message ID | 20240828220351.2686408-10-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/bitops: hweight() cleanup/improvements | expand |
On 29.08.2024 00:03, Andrew Cooper wrote: > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -326,6 +326,11 @@ static always_inline attr_const unsigned int hweightl(unsigned long x) > #endif > } > > +static always_inline attr_const unsigned int hweight32(uint32_t x) See my question/remark on the earlier patch: I think we want to be consistent with always-inline functions and const/pure attributes. Since elsewhere we omit it, I think it should be omitted here, too. Jan
diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h index 91cd167b6bbb..b28c25b3d52d 100644 --- a/xen/arch/arm/include/asm/bitops.h +++ b/xen/arch/arm/include/asm/bitops.h @@ -85,7 +85,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p, * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) generic_hweight64(x) -#define hweight32(x) generic_hweight32(x) #endif /* _ARM_BITOPS_H */ /* diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h index 64512e949530..f488a7c03425 100644 --- a/xen/arch/ppc/include/asm/bitops.h +++ b/xen/arch/ppc/include/asm/bitops.h @@ -133,6 +133,5 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr) * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) __builtin_popcountll(x) -#define hweight32(x) __builtin_popcount(x) #endif /* _ASM_PPC_BITOPS_H */ diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h index 4c5b21907a64..507b043b8a86 100644 --- a/xen/arch/x86/include/asm/bitops.h +++ b/xen/arch/x86/include/asm/bitops.h @@ -482,6 +482,5 @@ static always_inline unsigned int arch_flsl(unsigned long x) * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) generic_hweight64(x) -#define hweight32(x) generic_hweight32(x) #endif /* _X86_BITOPS_H */ diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index 58c600155f7e..a462c3065158 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -326,6 +326,11 @@ static always_inline attr_const unsigned int hweightl(unsigned long x) #endif } +static always_inline attr_const unsigned int hweight32(uint32_t x) +{ + return hweightl(x); +} + /* --------------------- Please tidy below here --------------------- */ #ifndef find_next_bit