diff options
author | Max <msuraev@sysmocom.de> | 2016-02-05 13:55:37 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-02-18 19:45:40 +0100 |
commit | 0a59e9899f4dd4213dc72d535f0b9d5382dc7eb7 (patch) | |
tree | 8219435070ebd60838e6e90a96d86b5911fe4df4 /include/osmocom | |
parent | 868471496698657b34e7105458f76306a76b6614 (diff) |
Expand bitvec interface
Add bit filling, shifting and other functions necessary for bit
compression implementation. Add corresponding tests.
Diffstat (limited to 'include/osmocom')
-rw-r--r-- | include/osmocom/core/bitvec.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h index a7e6fc4d..5314cf2a 100644 --- a/include/osmocom/core/bitvec.h +++ b/include/osmocom/core/bitvec.h @@ -4,6 +4,7 @@ /* (C) 2009 by Harald Welte <laforge@gnumonks.org> * (C) 2012 Ivan Klyuchnikov + * (C) 2015 Sysmocom s.f.m.c. GmbH * * All Rights Reserved * @@ -41,6 +42,7 @@ #include <stdint.h> #include <talloc.h> +#include <stdbool.h> /*! \brief A single GSM bit * @@ -82,5 +84,12 @@ unsigned int bitvec_pack(const struct bitvec *bv, uint8_t *buffer); unsigned int bitvec_unpack(struct bitvec *bv, const uint8_t *buffer); uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len); int bitvec_write_field(struct bitvec *bv, unsigned int *write_index, uint64_t val, unsigned int len); +int bitvec_fill(struct bitvec *bv, unsigned int num_bits, enum bit_value fill); +char bit_value_to_char(enum bit_value v); +void bitvec_to_string_r(const struct bitvec *bv, char *str); +void bitvec_zero(struct bitvec *bv); +unsigned bitvec_rl(const struct bitvec *bv, bool b); +void bitvec_shiftl(struct bitvec *bv, unsigned int n); +int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits); /*! @} */ |