Browse Source

bitmap: add endianness casts

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@braap.org>
Emilio G. Cota 12 years ago
parent
commit
9273220c47
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ccan/bitmap/bitmap.h

+ 2 - 2
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)