simplify stackless iterator is_cyclic (#2111)

This commit is contained in:
Mark
2023-10-14 23:56:46 -06:00
parent d96c9e00b7
commit 7875b96956
2 changed files with 23 additions and 15 deletions

View File

@@ -272,14 +272,9 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
#[inline]
fn is_cyclic(&self, var_current: usize, var_next: usize) -> bool {
if self.heap[var_next].is_var() {
var_current != var_next && self.current + 1 != var_current
} else if self.heap[var_next].is_ref() {
// the cell var_next in the second branch contains its original
// value whether var_next is marked or unmarked, meaning the
// is_compound check is well-founded in either case.
self.heap[var_next].get_forwarding_bit()
!self.heap[var_next].get_forwarding_bit() && var_current != var_next
} else {
false
self.heap[var_next].is_ref()
}
}