Commit 2a8b4826 authored by Emilio G. Cota's avatar Emilio G. Cota Committed by David Gibson

bitmap: use unsigned int for iterating over bitmap words

Bitmap words (e.g. resulting from BITMAP_{N,HEAD}WORDS) are of
unsigned type.

Use "unsigned int" to iterate over bitmap words to avoid comparisons
between signed and unsigned expressions. GCC otherwise warns about
these when -Wsign-compare is enabled.
Signed-off-by: default avatarEmilio G. Cota <cota@braap.org>
parent 710d42d0
......@@ -100,7 +100,7 @@ static inline void bitmap_copy(bitmap *dst, bitmap *src, int nbits)
static inline void bitmap_##_name(bitmap *dst, bitmap *src1, bitmap *src2, \
int nbits) \
{ \
int i = 0; \
unsigned int i = 0; \
for (i = 0; i < BITMAP_NWORDS(nbits); i++) { \
dst[i].w = src1[i].w _op src2[i].w; \
} \
......@@ -115,7 +115,7 @@ BITMAP_DEF_BINOP(andnot, & ~)
static inline void bitmap_complement(bitmap *dst, bitmap *src, int nbits)
{
int i;
unsigned int i;
for (i = 0; i < BITMAP_NWORDS(nbits); i++)
dst[i].w = ~src[i].w;
......@@ -130,7 +130,7 @@ static inline bool bitmap_equal(bitmap *src1, bitmap *src2, int nbits)
static inline bool bitmap_intersects(bitmap *src1, bitmap *src2, int nbits)
{
int i;
unsigned int i;
for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) {
if (src1[i].w & src2[i].w)
......@@ -144,7 +144,7 @@ static inline bool bitmap_intersects(bitmap *src1, bitmap *src2, int nbits)
static inline bool bitmap_subset(bitmap *src1, bitmap *src2, int nbits)
{
int i;
unsigned int i;
for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) {
if (src1[i].w & ~src2[i].w)
......@@ -158,7 +158,7 @@ static inline bool bitmap_subset(bitmap *src1, bitmap *src2, int nbits)
static inline bool bitmap_full(bitmap *bitmap, int nbits)
{
int i;
unsigned int i;
for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) {
if (bitmap[i].w != -1UL)
......@@ -173,7 +173,7 @@ static inline bool bitmap_full(bitmap *bitmap, int nbits)
static inline bool bitmap_empty(bitmap *bitmap, int nbits)
{
int i;
unsigned int i;
for (i = 0; i < BITMAP_HEADWORDS(nbits); i++) {
if (bitmap[i].w != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment