diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-02-04 12:09:05 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-02-05 11:16:44 +0100 |
commit | b0708d3e769851093ef633844d894b683a3c0341 (patch) | |
tree | 50ec260fa831746711c36502d8da6b6503408b46 /include/osmocom/core | |
parent | ae7966d145965452a325a33ca6334b6d6fe061a6 (diff) |
bitvec: Add bitvec_tailroom_bits() function
This is similar to msgb_tailroom(): It returns the amount of space
left at the end of the bit vector (compared to the current cursor).
The function returns the number of bits left in the bitvec.
Change-Id: I8980a6b6d1973b67a2d9ad411c878d956fb428d1
Diffstat (limited to 'include/osmocom/core')
-rw-r--r-- | include/osmocom/core/bitvec.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h index da2d4e45..bd107093 100644 --- a/include/osmocom/core/bitvec.h +++ b/include/osmocom/core/bitvec.h @@ -93,4 +93,10 @@ static inline unsigned int bitvec_used_bytes(const struct bitvec *bv) return bytes; } +/*! Return the tailroom in number of unused bits remaining in the bit-vector */ +static inline unsigned int bitvec_tailroom_bits(const struct bitvec *bv) +{ + return bv->data_len*8 - bv->cur_bit; +} + /*! @} */ |