diff options
Diffstat (limited to 'src/shared/libosmocore/src/bitvec.c')
-rw-r--r-- | src/shared/libosmocore/src/bitvec.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/shared/libosmocore/src/bitvec.c b/src/shared/libosmocore/src/bitvec.c index 95d78a5c..4fd38349 100644 --- a/src/shared/libosmocore/src/bitvec.c +++ b/src/shared/libosmocore/src/bitvec.c @@ -24,7 +24,7 @@ #include <errno.h> #include <stdint.h> -#include <osmocore/bitvec.h> +#include <osmocom/core/bitvec.h> #define BITNUM_FROM_COMP(byte, bit) ((byte*8)+bit) @@ -217,3 +217,17 @@ int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit) return 0; } + +/* find first bit set in bit vector */ +int bitvec_find_bit_pos(const struct bitvec *bv, unsigned int n, + enum bit_value val) +{ + unsigned int i; + + for (i = n; i < bv->data_len*8; i++) { + if (bitvec_get_bit_pos(bv, i) == val) + return i; + } + + return -1; +} |