hweight32()

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-06-27 15:20:54 -04:00
parent 57840fed19
commit 64ddfc9fc5

View File

@ -137,6 +137,11 @@ static inline unsigned long hweight64(u64 w)
__builtin_popcount(w >> 32); __builtin_popcount(w >> 32);
} }
static inline unsigned long hweight32(u32 w)
{
return __builtin_popcount(w);
}
static inline unsigned long hweight8(unsigned long w) static inline unsigned long hweight8(unsigned long w)
{ {
return __builtin_popcountl(w); return __builtin_popcountl(w);