Single byte input instead of buffering the input
parent
f39dde9c64
commit
5d7231ae8c
|
@ -9,7 +9,6 @@ pub fn run(program: Vec<u8>) {
|
|||
|
||||
let mut ip: usize = 0;
|
||||
let mut icount: usize = 0;
|
||||
let mut user_input: Vec<u8> = vec![];
|
||||
|
||||
let mut table: HashMap<usize, usize> = HashMap::new();
|
||||
let mut stack: VecDeque<usize> = VecDeque::new();
|
||||
|
@ -55,10 +54,7 @@ pub fn run(program: Vec<u8>) {
|
|||
icount += 1;
|
||||
}
|
||||
b',' => {
|
||||
if user_input.is_empty() {
|
||||
user_input = input();
|
||||
}
|
||||
tape[cell_index] = user_input.remove(0);
|
||||
tape[cell_index] = input().remove(0);
|
||||
icount += 1;
|
||||
}
|
||||
b'[' => {
|
||||
|
|
Loading…
Reference in New Issue