]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[bitmap] Fix bitmaps on 64-bit
authorGeoff Lywood <glywood@vmware.com>
Wed, 26 May 2010 23:39:17 +0000 (00:39 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 27 May 2010 00:18:17 +0000 (01:18 +0100)
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/bitmap.c
src/include/ipxe/bitmap.h

index 76fcef67bcc609309886b1e3fdaba6a45a80b3f6..e9b6d90413441556366ac7d8c149aa0c520898fb 100644 (file)
@@ -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 );
 }
 
 /**
index 38d1f221df884b88db59c56fbc592aafdee75583..b18584c1f866bb38b5a759acf316d0a5cc7653a2 100644 (file)
@@ -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 {