collaps els-if / if-if
This commit is contained in:
committed by
Bennet Bleßmann
parent
7593f88d5a
commit
c885d1a7e7
@@ -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:
|
||||||
|
|||||||
@@ -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!()
|
||||||
|
|||||||
Reference in New Issue
Block a user