summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-27 15:20:54 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-27 15:58:39 -0400
commit64ddfc9fc5628f27cdc1399a283452196a7e2dcc (patch)
tree77afc52c6cd183ff49cdf20df4b97a23761f89da
parent57840fed199a9e8e9ef94b44c851b68b7c096086 (diff)
hweight32()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--include/linux/bitops.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 2fe736e..62a3f40 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -137,6 +137,11 @@ static inline unsigned long hweight64(u64 w)
__builtin_popcount(w >> 32);
}
+static inline unsigned long hweight32(u32 w)
+{
+ return __builtin_popcount(w);
+}
+
static inline unsigned long hweight8(unsigned long w)
{
return __builtin_popcountl(w);