bitvec: Fix -Wsign-compare warnings

Change-Id: I34f65cda83bcd7050bd0cc0fb9e5cb5d33a09086
This commit is contained in:
Harald Welte 2022-01-09 11:56:19 +01:00
parent 42dcbf0c1f
commit c85aaed3fb
2 changed files with 5 additions and 4 deletions

View File

@ -73,7 +73,7 @@ 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);
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits);
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, unsigned int max_bits);
void bitvec_shiftl(struct bitvec *bv, unsigned int n);
int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits);
unsigned int bitvec_add_array(struct bitvec *bv, const uint32_t *array,

View File

@ -197,7 +197,8 @@ int bitvec_get_bit_high(struct bitvec *bv)
* \return 0 on success; negative in case of error */
int bitvec_set_bits(struct bitvec *bv, const enum bit_value *bits, unsigned int count)
{
int i, rc;
unsigned int i;
int rc;
for (i = 0; i < count; i++) {
rc = bitvec_set_bit(bv, bits[i]);
@ -260,7 +261,7 @@ int16_t bitvec_get_int16_msb(const struct bitvec *bv, unsigned int num_bits)
* \return integer value retrieved from bit vector */
int bitvec_get_uint(struct bitvec *bv, unsigned int num_bits)
{
int i;
unsigned int i;
unsigned int ui = 0;
for (i = 0; i < num_bits; i++) {
@ -603,7 +604,7 @@ unsigned bitvec_rl(const struct bitvec *bv, bool b)
* \returns Number of consecutive bits of \p b in \p bv and cur_bit will
* \go to cur_bit + number of consecutive bit
*/
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, int max_bits)
unsigned bitvec_rl_curbit(struct bitvec *bv, bool b, unsigned int max_bits)
{
unsigned i = 0;
unsigned j = 8;