fix: under/overflow
This commit is contained in:
@@ -11,8 +11,8 @@ fn interpret(code: &str) {
|
||||
match code_bytes[pc] as char {
|
||||
'>' => head += 1,
|
||||
'<' => head -= 1,
|
||||
'+' => memory[head] += 1,
|
||||
'-' => memory[head] -= 1,
|
||||
'+' => memory[head] = memory[head].wrapping_add(1),
|
||||
'-' => memory[head] = memory[head].wrapping_sub(1),
|
||||
'.' => println!("{}", memory[head]),
|
||||
',' => {
|
||||
let mut input_buf = [0u8; 1];
|
||||
|
||||
Reference in New Issue
Block a user