diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-04-26 00:28:18 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-04-26 00:28:18 +0200 |
commit | f0059596a20bfa406a500ca5d6b34bf88d333ed3 (patch) | |
tree | 41bc483077171529e20084ede0784dd6af076056 /src/shared/libosmocore/src/bitvec.c | |
parent | d9639bb010d05a96a6cbced94668c5754a4f0de9 (diff) | |
parent | 28dbfe9bf7a799ab1da2563fd5e007d007b54168 (diff) |
Merge commit '28dbfe9bf7a799ab1da2563fd5e007d007b54168'
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; +} |