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

Method do_binary_double_op

core/src/vm/context.rs:486–499  ·  view source on GitHub ↗

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

484 /// Applies a binary double operation using `parse` to decode the instruction and `op` to
485 /// compute the result.
486 fn do_binary_double_op<F>(
487 &mut self,
488 instr: u32,
489 parse: fn(u32) -> (Register, Register, Register),
490 op: F,
491 ) where
492 F: Fn(f64, f64) -> f64,
493 {
494 let (dest, src1, src2) = parse(instr);
495 let lhs = f64::from_bits(self.get_reg(src1));
496 let rhs = f64::from_bits(self.get_reg(src2));
497 self.set_reg(dest, op(lhs, rhs).to_bits());
498 self.pc += 1;
499 }
500
501 /// Applies a binary double predicate using `parse` to decode the instruction and `op` to
502 /// compute the result.

Callers 6

do_add_doubleMethod · 0.80
do_divide_doubleMethod · 0.80
do_modulo_doubleMethod · 0.80
do_multiply_doubleMethod · 0.80
do_power_doubleMethod · 0.80
do_subtract_doubleMethod · 0.80

Calls 3

parseFunction · 0.85
get_regMethod · 0.80
set_regMethod · 0.80

Tested by

no test coverage detected