Skip to content

Commit

Permalink
fix: fix truncate bug in pop command
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-kr committed Dec 12, 2023
1 parent 4a73443 commit a76d2a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl Memory {
// stack operations

pub fn pop_stack(&mut self) {
self.stack.pop();
let sub = self.stack.len().saturating_sub(4);
self.stack.truncate(sub);
}

pub fn reset_stack(&mut self) {
Expand Down

0 comments on commit a76d2a8

Please sign in to comment.