summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2022-01-24 14:44:58 -0500
committerPeter Zhu <[email protected]>2022-01-25 09:38:17 -0500
commitb07879e553a73200ec1d2c3f6b12127e22f965cd (patch)
tree282b71c9a5648713f783c7e0d9183697445f74eb /gc.c
parente3b5cc8836197dc2940a297b9130ed545bc3f7a7 (diff)
Remove redundant if statement in try_move
The if statement is redundant since if `index == 0` then `BITS_BITLENGTH * index == 0`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5479
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/gc.c b/gc.c
index d189c42cde..d448c7515d 100644
--- a/gc.c
+++ b/gc.c
@@ -4959,12 +4959,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page,
bits >>= NUM_IN_PAGE(p) % BITS_BITLENGTH;
if (try_move_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1;
- if (index == 0) {
- p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start));
- }
- else {
- p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
- }
+ p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
/* Find an object to move and move it. Movable objects must be
* marked, so we iterate using the marking bitmap */