diff --git a/src/core/bitmap.c b/src/core/bitmap.c index 76fcef67..e9b6d904 100644 --- a/src/core/bitmap.c +++ b/src/core/bitmap.c @@ -76,7 +76,7 @@ int bitmap_test ( struct bitmap *bitmap, unsigned int bit ) { if ( bit >= bitmap->length ) return 0; - return ( bitmap->blocks[index] & mask ); + return ( ( bitmap->blocks[index] & mask ) != 0 ); } /** diff --git a/src/include/ipxe/bitmap.h b/src/include/ipxe/bitmap.h index 38d1f221..b18584c1 100644 --- a/src/include/ipxe/bitmap.h +++ b/src/include/ipxe/bitmap.h @@ -33,7 +33,7 @@ typedef unsigned long bitmap_block_t; * @v bit Bit index * @ret mask Block mask */ -#define BITMAP_MASK( bit ) ( 1 << ( (bit) % BITMAP_BLKSIZE ) ) +#define BITMAP_MASK( bit ) ( 1UL << ( (bit) % BITMAP_BLKSIZE ) ) /** A bitmap */ struct bitmap {