Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140043717
D54301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
861 B
Referenced Files
None
Subscribers
None
D54301.diff
View Options
diff --git a/sys/sys/bitcount.h b/sys/sys/bitcount.h
--- a/sys/sys/bitcount.h
+++ b/sys/sys/bitcount.h
@@ -39,6 +39,28 @@
#include <sys/_types.h>
+#define __const_bitcount8(x) ( \
+ !!((x) & (1 << 0)) + \
+ !!((x) & (1 << 1)) + \
+ !!((x) & (1 << 2)) + \
+ !!((x) & (1 << 3)) + \
+ !!((x) & (1 << 4)) + \
+ !!((x) & (1 << 5)) + \
+ !!((x) & (1 << 6)) + \
+ !!((x) & (1 << 7)))
+
+#define __const_bitcount16(x) ( \
+ __const_bitcount8(x) + \
+ __const_bitcount8((x) >> 8))
+
+#define __const_bitcount32(x) ( \
+ __const_bitcount16(x) + \
+ __const_bitcount16((x) >> 16))
+
+#define __const_bitcount64(x) ( \
+ __const_bitcount32(x) + \
+ __const_bitcount32((x) >> 32))
+
#ifdef __POPCNT__
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 20, 11:15 AM (15 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27088532
Default Alt Text
D54301.diff (861 B)
Attached To
Mode
D54301: sys/bitcount.h: add __const_bitcount<n>
Attached
Detach File
Event Timeline
Log In to Comment