MCPcopy Index your code
hub / github.com/endbasic/endbasic / do_binary_boolean_op

Method do_binary_boolean_op

core/src/vm/context.rs:562–575  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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.

Callers 2

do_equal_booleanMethod · 0.80
do_not_equal_booleanMethod · 0.80

Calls 3

parseFunction · 0.85
get_regMethod · 0.80
set_regMethod · 0.80

Tested by

no test coverage detected