diff --git a/src/main.rs b/src/main.rs index 89d97ec..0cac004 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,10 +105,10 @@ fn exec(instructions: Vec) -> 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 { /* 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 => (),