eval: implemented logical binary operations
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -105,10 +105,10 @@ fn exec(instructions: Vec<i64>) -> i64 {
|
||||
/* SUB */ 2 => binop(&mut stack, |x, y| x - y),
|
||||
/* MUL */ 3 => binop(&mut stack, |x, y| x * y),
|
||||
/* DIV */ 4 => binop(&mut stack, |x, y| x / y),
|
||||
/* MOD */ 5 => (),
|
||||
/* LT */ 6 => (),
|
||||
/* EQ */ 7 => (),
|
||||
/* GT */ 8 => (),
|
||||
/* MOD */ 5 => binop(&mut stack, |x, y| x % y),
|
||||
/* LT */ 6 => binop(&mut stack, |x, y| (x < y) as i64),
|
||||
/* EQ */ 7 => binop(&mut stack, |x, y| (x == y) as i64),
|
||||
/* GT */ 8 => binop(&mut stack, |x, y| (x > y) as i64),
|
||||
/* BR */ 9 => (),
|
||||
/* BRT */ 10 => (),
|
||||
/* BRF */ 11 => (),
|
||||
@@ -120,8 +120,8 @@ fn exec(instructions: Vec<i64>) -> i64 {
|
||||
/* PRN */ 17 => (),
|
||||
/* POP */ 18 => (),
|
||||
/* HLT */ 19 => break,
|
||||
/* LEQ */ 20 => (),
|
||||
/* GEQ */ 21 => (),
|
||||
/* LEQ */ 20 => binop(&mut stack, |x, y| (x <= y) as i64),
|
||||
/* GEQ */ 21 => binop(&mut stack, |x, y| (x >= y) as i64),
|
||||
/* CAL */ 22 => (),
|
||||
/* RET */ 23 => (),
|
||||
/* IPR */ 24 => (),
|
||||
|
Reference in New Issue
Block a user