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

Method do_binary_integer_predicate_op

core/src/vm/context.rs:545–558  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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.

Callers 6

do_equal_integerMethod · 0.80
do_greater_integerMethod · 0.80
do_less_equal_integerMethod · 0.80
do_less_integerMethod · 0.80
do_not_equal_integerMethod · 0.80

Calls 3

parseFunction · 0.85
get_regMethod · 0.80
set_regMethod · 0.80

Tested by

no test coverage detected