From 2a8b4826ddf8face89bd37a5fc0982474f96e2e3 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 10 Mar 2014 11:04:50 -0400 Subject: [PATCH] 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: Emilio G. Cota --- ccan/bitmap/bitmap.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ccan/bitmap/bitmap.h b/ccan/bitmap/bitmap.h index 50086c06..2be18f31 100644 --- a/ccan/bitmap/bitmap.h +++ b/ccan/bitmap/bitmap.h @@ -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) -- 2.39.2