aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Cohen <eli@mellanox.co.il>2007-06-04 17:16:35 +0300
committerRoland Dreier <rolandd@cisco.com>2007-06-04 12:49:14 -0700
commit5de6edbaf6a34967d79f1d7082ad8371e79fb766 (patch)
tree016eb9f14372ebba6add75fd6d0a30c4cefdf5ec
parentfdb57ccf86432dd8994c726eb2bf419766eed5b2 (diff)
downloadlibmlx4-5de6edbaf6a34967d79f1d7082ad8371e79fb766.tar.gz
Fix word size in doorbell allocator bitmaps
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>
-rw-r--r--src/dbrec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dbrec.c b/src/dbrec.c
index e59bc9e..02ef237 100644
--- a/src/dbrec.c
+++ b/src/dbrec.c
@@ -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)