X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fbitmap%2Fbitmap.h;h=50086c065303d06f435c472eed11439cf8048e49;hp=259b35149a90b3286d1ead12ec2c00f0e5dc47dc;hb=9273220c47005235da7cfed1221e13dd19065093;hpb=e0b9db615fab66e1b9236b0511dee948b8c4ece7 diff --git a/ccan/bitmap/bitmap.h b/ccan/bitmap/bitmap.h index 259b3514..50086c06 100644 --- a/ccan/bitmap/bitmap.h +++ b/ccan/bitmap/bitmap.h @@ -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)