summaryrefslogtreecommitdiffstats
path: root/sys/sys/bitset.h
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2013-06-13 20:46:03 +0000
committerjeff <jeff@FreeBSD.org>2013-06-13 20:46:03 +0000
commit7ee88fb112275ba704d022b9feebc6bbd4cddf2e (patch)
tree88a1eaa0fdaa8c6f93574ecfb224a95f498892b9 /sys/sys/bitset.h
parent21c714c60959a0ddca57e0500d0f93287099f971 (diff)
downloadFreeBSD-src-7ee88fb112275ba704d022b9feebc6bbd4cddf2e.zip
FreeBSD-src-7ee88fb112275ba704d022b9feebc6bbd4cddf2e.tar.gz
- Add a BIT_FFS() macro and use it to replace cpusetffs_obj()
Discussed with: attilio Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/sys/bitset.h')
-rw-r--r--sys/sys/bitset.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h
index c93cb2c..dee5542 100644
--- a/sys/sys/bitset.h
+++ b/sys/sys/bitset.h
@@ -150,4 +150,19 @@
(f)->__bits[__i]); \
} while (0)
+#define BIT_FFS(_s, p) __extension__ ({ \
+ __size_t __i; \
+ int __bit; \
+ \
+ __bit = 0; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) { \
+ if ((p)->__bits[__i] != 0) { \
+ __bit = ffsl((p)->__bits[__i]); \
+ __bit += __i * _BITSET_BITS; \
+ break; \
+ } \
+ } \
+ __bit; \
+})
+
#endif /* !_SYS_BITSET_H_ */
OpenPOWER on IntegriCloud