diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-02-06 13:29:50 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-02-06 14:21:16 -0500 |
commit | 3cd1305ffcc4a5e3269aeb2e0694dddb7ca480d0 (patch) | |
tree | fc0e8a3597e046fa0bd53b45fa4bc66d47ac25a3 | |
parent | 2987b041a3811b25bcee402ce6fdab80827dc90e (diff) | |
download | haskell-3cd1305ffcc4a5e3269aeb2e0694dddb7ca480d0.tar.gz |
rts: Use BITS_IN macro in bitmap calculations
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4386
-rw-r--r-- | rts/sm/Compact.h | 12 | ||||
-rw-r--r-- | rts/sm/GC.c | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/rts/sm/Compact.h b/rts/sm/Compact.h index 6dcb50b1aa..63abfc7180 100644 --- a/rts/sm/Compact.h +++ b/rts/sm/Compact.h @@ -20,8 +20,8 @@ mark(StgPtr p, bdescr *bd) { uint32_t offset_within_block = p - bd->start; // in words StgPtr bitmap_word = (StgPtr)bd->u.bitmap + - (offset_within_block / (sizeof(W_)*BITS_PER_BYTE)); - StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1)); + (offset_within_block / BITS_IN(W_)); + StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_) - 1)); *bitmap_word |= bit_mask; } @@ -30,8 +30,8 @@ unmark(StgPtr p, bdescr *bd) { uint32_t offset_within_block = p - bd->start; // in words StgPtr bitmap_word = (StgPtr)bd->u.bitmap + - (offset_within_block / (sizeof(W_)*BITS_PER_BYTE)); - StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1)); + (offset_within_block / BITS_IN(W_)); + StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_) - 1)); *bitmap_word &= ~bit_mask; } @@ -40,8 +40,8 @@ is_marked(StgPtr p, bdescr *bd) { uint32_t offset_within_block = p - bd->start; // in words StgPtr bitmap_word = (StgPtr)bd->u.bitmap + - (offset_within_block / (sizeof(W_)*BITS_PER_BYTE)); - StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1)); + (offset_within_block / BITS_IN(W_)); + StgWord bit_mask = (StgWord)1 << (offset_within_block & (BITS_IN(W_)- 1)); return (*bitmap_word & bit_mask); } diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 197b46657b..54797ba0f0 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -1372,7 +1372,7 @@ prepare_collected_gen (generation *gen) bdescr *bitmap_bdescr; StgWord *bitmap; - bitmap_size = gen->n_old_blocks * BLOCK_SIZE / (sizeof(W_)*BITS_PER_BYTE); + bitmap_size = gen->n_old_blocks * BLOCK_SIZE / BITS_IN(W_); if (bitmap_size > 0) { bitmap_bdescr = allocGroup((StgWord)BLOCK_ROUND_UP(bitmap_size) @@ -1390,7 +1390,7 @@ prepare_collected_gen (generation *gen) // block descriptor. for (bd=gen->old_blocks; bd != NULL; bd = bd->link) { bd->u.bitmap = bitmap; - bitmap += BLOCK_SIZE_W / (sizeof(W_)*BITS_PER_BYTE); + bitmap += BLOCK_SIZE_W / BITS_IN(W_); // Also at this point we set the BF_MARKED flag // for this block. The invariant is that |