Applies a binary boolean operation using `parse` to decode the instruction and `op` to compute the result.
(
&mut self,
instr: u32,
parse: fn(u32) -> (Register, Register, Register),
op: F,
)
| 560 | /// Applies a binary boolean operation using `parse` to decode the instruction and `op` to |
| 561 | /// compute the result. |
| 562 | fn do_binary_boolean_op<F>( |
| 563 | &mut self, |
| 564 | instr: u32, |
| 565 | parse: fn(u32) -> (Register, Register, Register), |
| 566 | op: F, |
| 567 | ) where |
| 568 | F: Fn(bool, bool) -> bool, |
| 569 | { |
| 570 | let (dest, src1, src2) = parse(instr); |
| 571 | let lhs = self.get_reg(src1) != 0; |
| 572 | let rhs = self.get_reg(src2) != 0; |
| 573 | self.set_reg(dest, if op(lhs, rhs) { 1 } else { 0 }); |
| 574 | self.pc += 1; |
| 575 | } |
| 576 | |
| 577 | /// Applies a binary text operation using `parse` to decode the instruction and `op` to |
| 578 | /// compute the result. |
no test coverage detected