aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/common.h b/common.h
index 4587315..f9cc203 100644
--- a/common.h
+++ b/common.h
@@ -484,6 +484,14 @@ bsunion(struct bitset dst[/*siz*/], const struct bitset src[/*siz*/], uint siz)
while (siz--) dst++->u |= src++->u;
}
+static inline uint
+bscount(struct bitset bs[/*siz*/], uint siz)
+{
+ uint n = 0;
+ while (siz--) n += popcnt(bs++->u);
+ return n;
+}
+
static inline bool
bsiter(uint *i, struct bitset bs[/*siz*/], uint siz)
{