aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-09 14:05:54 +0200
committerlemon <lsof@mailbox.org>2025-10-09 14:05:54 +0200
commit9df18e9b384a56902ef1517bc269b8c345149e12 (patch)
tree9bea4f13167e2996813578a121bd4f4e8fde5290 /common.h
parentc1ab2a12cdaec4b701f2f9f994a174a6b838212c (diff)
c: call memset for some runtime zero initializations
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)
{