collaps els-if / if-if

This commit is contained in:
Bennet Bleßmann
2025-07-31 21:41:23 +02:00
committed by Bennet Bleßmann
parent 7593f88d5a
commit c885d1a7e7
2 changed files with 6 additions and 10 deletions

View File

@@ -745,11 +745,9 @@ impl Heap {
// the heap to a pre-allocated resource error
pub(crate) fn push_cell(&mut self, cell: HeapCellValue) -> Result<(), usize> {
unsafe {
if self.inner.byte_len == self.inner.byte_cap {
if !self.grow() {
if self.inner.byte_len == self.inner.byte_cap && !self.grow() {
return Err(self.resource_error_offset());
}
}
// SAFETY:
// - Postcondition: from `self.grow()`, `self.inner.byte_len + size_of::<HeapCellValue>()`

View File

@@ -847,14 +847,12 @@ impl MachineState {
if let Some(c) = char_iter.next() {
if n == 1 {
self.unify_char(c, a3);
} else {
if char_iter.next().is_some() {
} else if char_iter.next().is_some() {
unify_fn!(*self, pstr_loc_as_cell!(pstr_loc + c.len_utf8()), a3);
} else {
let tail_idx = Heap::pstr_tail_idx(pstr_loc + c.len_utf8());
unify_fn!(*self, self.heap[tail_idx], a3);
}
}
} else {
unreachable!()
}