1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Remove redundant if statement in try_move

The if statement is redundant since if `index == 0` then
`BITS_BITLENGTH * index == 0`.
This commit is contained in:
Peter Zhu 2022-01-24 14:44:58 -05:00
parent e3b5cc8836
commit b07879e553
Notes: git 2022-01-25 23:38:45 +09:00

7
gc.c
View file

@ -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 */