/* get the Nth set bit inside the bit vector */ unsigned int bitvec_get_nth_set_bit(struct bitvec *bv, unsigned int n) { unsigned int i, k = 0; for (i = 0; i < bv->data_len*8; i++) { if (bitvec_get_bit_pos(bv, i) == ONE) { k++; if (k == n) return i; } } return 0; }
int bitvec2arfcn_list_range(uint8_t *range, struct bitvec *bv, uint16_t range) { unsigned int i, idx = 0; int F[MAX_ARFCNS+1]; int W[MAX_ARFCNS+1]; /* build an array of integers from the bitmask */ for (i = 0; i < bv->data_len*8; i++) { if (bitvec_get_bit_pos(bv, i)) F[idx++] = i; } /* Perform the actual algorithm to calculate the 'W' values */ CalcARFCN(F, W, idx, range); /* FIXME: Encode the 'W' values into the actual format as used in 04.08 */ return -EIO; }