]> git.ozlabs.org Git - ccan/blobdiff - ccan/bitmap/bitmap.h
opt: avoid using %lld and %llx formats
[ccan] / ccan / bitmap / bitmap.h
index 259b35149a90b3286d1ead12ec2c00f0e5dc47dc..50086c065303d06f435c472eed11439cf8048e49 100644 (file)
@@ -22,6 +22,9 @@ typedef struct {
        bitmap_word w;
 } bitmap;
 
+#define BITMAP_DECLARE(_name, _nbits) \
+       bitmap (_name)[BITMAP_NWORDS(_nbits)]
+
 static inline size_t bitmap_sizeof(int nbits)
 {
        return BITMAP_NWORDS(nbits) * sizeof(bitmap_word);
@@ -35,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)