[ccan] [PATCH] bitmap: add endianness casts
Emilio G. Cota
cota at braap.org
Thu Dec 19 17:00:15 EST 2013
From: "Emilio G. Cota" <cota at braap.org>
sparse yells at us when it realises we are implicitly casting an
endian type (big endian) to a plain unsigned long.
Get rid of this warning by telling sparse that we know what
we are doing.
Signed-off-by: Emilio G. Cota <cota at braap.org>
---
ccan/bitmap/bitmap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ccan/bitmap/bitmap.h b/ccan/bitmap/bitmap.h
index f43449d..50086c0 100644
--- a/ccan/bitmap/bitmap.h
+++ b/ccan/bitmap/bitmap.h
@@ -38,9 +38,9 @@ static inline bitmap *bitmap_alloc(int nbits)
static inline bitmap_word bitmap_bswap(bitmap_word w)
{
if (BITMAP_WORD_BITS == 32)
- return cpu_to_be32(w);
+ return (ENDIAN_CAST bitmap_word)cpu_to_be32(w);
else if (BITMAP_WORD_BITS == 64)
- return cpu_to_be64(w);
+ return (ENDIAN_CAST bitmap_word)cpu_to_be64(w);
}
#define BITMAP_WORD(_bm, _n) ((_bm)[(_n) / BITMAP_WORD_BITS].w)
--
1.8.3
More information about the ccan
mailing list