summaryrefslogtreecommitdiff
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r--include/linux/bitops.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index dc2927b..f2183d5 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -120,6 +120,12 @@ static inline unsigned long hweight_long(unsigned long w)
return __builtin_popcountl(w);
}
+static inline unsigned long hweight64(u64 w)
+{
+ return __builtin_popcount((u32) w) +
+ __builtin_popcount(w >> 32);
+}
+
static inline unsigned long hweight8(unsigned long w)
{
return __builtin_popcountl(w);