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

Method do_binary_double_predicate_op

core/src/vm/context.rs:503–516  ·  view source on GitHub ↗

Applies a binary double 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

501 /// Applies a binary double predicate using `parse` to decode the instruction and `op` to
502 /// compute the result.
503 fn do_binary_double_predicate_op<F>(
504 &mut self,
505 instr: u32,
506 parse: fn(u32) -> (Register, Register, Register),
507 op: F,
508 ) where
509 F: Fn(f64, f64) -> bool,
510 {
511 let (dest, src1, src2) = parse(instr);
512 let lhs = f64::from_bits(self.get_reg(src1));
513 let rhs = f64::from_bits(self.get_reg(src2));
514 self.set_reg(dest, if op(lhs, rhs) { 1 } else { 0 });
515 self.pc += 1;
516 }
517
518 /// Applies a binary integer operation using `parse` to decode the instruction and `op` to
519 /// compute the result. `op` returns `Err` with a message on failure.

Callers 6

do_equal_doubleMethod · 0.80
do_greater_doubleMethod · 0.80
do_less_doubleMethod · 0.80
do_less_equal_doubleMethod · 0.80
do_not_equal_doubleMethod · 0.80

Calls 3

parseFunction · 0.85
get_regMethod · 0.80
set_regMethod · 0.80

Tested by

no test coverage detected