Add if else if chains
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
ef02e94591
commit
ff308649b9
10 changed files with 241 additions and 115 deletions
|
|
@ -67,6 +67,16 @@ pub fn execute(
|
|||
}
|
||||
}
|
||||
}
|
||||
Instruction::Jump { jump } => {
|
||||
let (new_ip, overflow) = ip.overflowing_add_signed(*jump);
|
||||
|
||||
if overflow {
|
||||
return Err(EvaluationError::InstructionPointerOverflow);
|
||||
} else {
|
||||
ip = new_ip;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ip += 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue