correct PStrLocation offset bug in copier.rs

This commit is contained in:
Mark Thom
2020-02-20 10:59:42 -07:00
parent e5a0ba7bf3
commit d48ac09e25
2 changed files with 2 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ impl<'a> HCPreOrderIterator<'a> {
Addr::PStrLocation(h, n) => {
if let HeapCellValue::PartialString(ref pstr) = &self.machine_st.heap[h] {
let s = pstr.block_as_str();
if let Some(c) = s[n ..].chars().next() {
if pstr.len() > n + c.len_utf8() {
self.state_stack.push(Addr::PStrLocation(h, n + c.len_utf8()));

View File

@@ -191,7 +191,7 @@ impl<T: CopierTarget> CopyTermState<T> {
let threshold = self.target.threshold();
self.target[self.scan] =
HeapCellValue::Addr(Addr::PStrLocation(threshold, n));
HeapCellValue::Addr(Addr::PStrLocation(threshold, 0));
self.scan += 1;