]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Fix word size in doorbell allocator bitmaps
authorEli Cohen <eli@mellanox.co.il>
Mon, 4 Jun 2007 14:16:35 +0000 (17:16 +0300)
committerRoland Dreier <rolandd@cisco.com>
Mon, 4 Jun 2007 19:49:14 +0000 (12:49 -0700)
Use an explicitly long constant 1UL identical to the type of the
variable holding the bit mask.  This avoids using the same bit twice,
because on 64 bit architectures, 1 << 32 == 0.

Found by Dotan Barak at Mellanox.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
src/dbrec.c

index e59bc9e6565ee260732ec1c438d20d5e1165af58..02ef237b3921dd31e5e9e5e054d23c86674f6b10 100644 (file)
@@ -110,7 +110,7 @@ found:
                /* nothing */;
 
        j = ffsl(page->free[i]);
-       page->free[i] &= ~(1 << (j - 1));
+       page->free[i] &= ~(1UL << (j - 1));
        db = page->buf.buf + (i * 8 * sizeof (long) + (j - 1)) * db_size[type];
 
 out:
@@ -135,7 +135,7 @@ void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t
                goto out;
 
        i = ((void *) db - page->buf.buf) / db_size[type];
-       page->free[i / (8 * sizeof (long))] |= 1 << (i % (8 * sizeof (long)));
+       page->free[i / (8 * sizeof (long))] |= 1UL << (i % (8 * sizeof (long)));
 
        if (!--page->use_cnt) {
                if (page->prev)