Browse Source

[bitmap] Fix bitmaps on 64-bit

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Geoff Lywood 14 years ago
parent
commit
83efb3d750
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      src/core/bitmap.c
  2. 1
    1
      src/include/ipxe/bitmap.h

+ 1
- 1
src/core/bitmap.c View File

@@ -76,7 +76,7 @@ int bitmap_test ( struct bitmap *bitmap, unsigned int bit ) {
76 76
 
77 77
 	if ( bit >= bitmap->length )
78 78
 		return 0;
79
-	return ( bitmap->blocks[index] & mask );
79
+	return ( ( bitmap->blocks[index] & mask ) != 0 );
80 80
 }
81 81
 
82 82
 /**

+ 1
- 1
src/include/ipxe/bitmap.h View File

@@ -33,7 +33,7 @@ typedef unsigned long bitmap_block_t;
33 33
  * @v bit		Bit index
34 34
  * @ret mask		Block mask
35 35
  */
36
-#define BITMAP_MASK( bit ) ( 1 << ( (bit) % BITMAP_BLKSIZE ) )
36
+#define BITMAP_MASK( bit ) ( 1UL << ( (bit) % BITMAP_BLKSIZE ) )
37 37
 
38 38
 /** A bitmap */
39 39
 struct bitmap {

Loading…
Cancel
Save