From b07879e553a73200ec1d2c3f6b12127e22f965cd Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 24 Jan 2022 14:44:58 -0500 Subject: [PATCH] Remove redundant if statement in try_move The if statement is redundant since if `index == 0` then `BITS_BITLENGTH * index == 0`. --- gc.c | 7 +------ 1 file changed, 1 insertion(+), 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 */