diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-03-28 19:24:19 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-03-28 20:00:45 +0200 |
commit | 36bdf2cb73a82548cc1a6a9e332a4e646a5868b2 (patch) | |
tree | 3c4836cb51f163b4c58e3f6d2f33fd8470a8248b /src | |
parent | d6643d5fcf627d64cc3d7c385ba1cdd3981a8663 (diff) |
bitvec: add bitvec_find_first_bit_pos() from gsm/rxlev_stat.c
This patch adds bitvec_find_bit_pos() to bitvec.c where it really
belongs to. Before this patch used to be part of gsm/rxlev_stat.c
Diffstat (limited to 'src')
-rw-r--r-- | src/bitvec.c | 14 | ||||
-rw-r--r-- | src/gsm/rxlev_stat.c | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/bitvec.c b/src/bitvec.c index 4984af22..4fd38349 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -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; +} diff --git a/src/gsm/rxlev_stat.c b/src/gsm/rxlev_stat.c index 626aaffb..d226861e 100644 --- a/src/gsm/rxlev_stat.c +++ b/src/gsm/rxlev_stat.c @@ -30,18 +30,6 @@ #include <osmocom/core/bitvec.h> #include <osmocom/gsm/rxlev_stat.h> -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; -} - void rxlev_stat_input(struct rxlev_stats *st, uint16_t arfcn, uint8_t rxlev) { struct bitvec bv; |