Applies a binary integer predicate using `parse` to decode the instruction and `op` to compute the result.
(
&mut self,
instr: u32,
parse: fn(u32) -> (Register, Register, Register),
op: F,
)
| 543 | /// Applies a binary integer predicate using `parse` to decode the instruction and `op` to |
| 544 | /// compute the result. |
| 545 | fn do_binary_integer_predicate_op<F>( |
| 546 | &mut self, |
| 547 | instr: u32, |
| 548 | parse: fn(u32) -> (Register, Register, Register), |
| 549 | op: F, |
| 550 | ) where |
| 551 | F: Fn(i32, i32) -> bool, |
| 552 | { |
| 553 | let (dest, src1, src2) = parse(instr); |
| 554 | let lhs = self.get_reg(src1) as i32; |
| 555 | let rhs = self.get_reg(src2) as i32; |
| 556 | self.set_reg(dest, if op(lhs, rhs) { 1 } else { 0 }); |
| 557 | self.pc += 1; |
| 558 | } |
| 559 | |
| 560 | /// Applies a binary boolean operation using `parse` to decode the instruction and `op` to |
| 561 | /// compute the result. |
no test coverage detected