summaryrefslogtreecommitdiff
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-03-28 05:21:24 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2019-03-28 05:28:38 -0400
commit133dfeb64843af65a018be770eb005363ca59bd9 (patch)
tree6d37383fdb83a5bc618ec506fd1e14c22d7a32c2 /include/linux/bitops.h
parent365d3450058ba0a8d282d8155bfcc2057837ab95 (diff)
Update bcachefs sources to d868a87c67 bcachefs: fix initial gc
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 dc2927b3..f2183d54 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);