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,10 +745,8 @@ impl Heap {
// the heap to a pre-allocated resource error // the heap to a pre-allocated resource error
pub(crate) fn push_cell(&mut self, cell: HeapCellValue) -> Result<(), usize> { pub(crate) fn push_cell(&mut self, cell: HeapCellValue) -> Result<(), usize> {
unsafe { unsafe {
if self.inner.byte_len == self.inner.byte_cap { if self.inner.byte_len == self.inner.byte_cap && !self.grow() {
if !self.grow() { return Err(self.resource_error_offset());
return Err(self.resource_error_offset());
}
} }
// SAFETY: // SAFETY:

View File

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