summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/bitvec.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h
index c9bab398..da2d4e45 100644
--- a/include/osmocom/core/bitvec.h
+++ b/include/osmocom/core/bitvec.h
@@ -84,4 +84,13 @@ unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array,
unsigned int array_len, bool dry_run,
unsigned int num_bits);
+/*! Return the number of bytes used within the bit vector */
+static inline unsigned int bitvec_used_bytes(const struct bitvec *bv)
+{
+ unsigned int bytes = bv->cur_bit/8;
+ if (bv->cur_bit%8)
+ bytes++;
+ return bytes;
+}
+
/*! @} */