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

Method do_binary_text_op

core/src/vm/context.rs:579–594  ·  view source on GitHub ↗

Applies a binary text operation using `parse` to decode the instruction and `op` to compute the result.

(
        &mut self,
        instr: u32,
        constants: &[ConstantDatum],
        heap: &Heap,
        parse: fn(u32) -> (Register, Register, Register),
        op: F,
    )

Source from the content-addressed store, hash-verified

577 /// Applies a binary text operation using `parse` to decode the instruction and `op` to
578 /// compute the result.
579 fn do_binary_text_op<F>(
580 &mut self,
581 instr: u32,
582 constants: &[ConstantDatum],
583 heap: &Heap,
584 parse: fn(u32) -> (Register, Register, Register),
585 op: F,
586 ) where
587 F: Fn(&str, &str) -> bool,
588 {
589 let (dest, src1, src2) = parse(instr);
590 let lhs = self.deref_string(src1, constants, heap);
591 let rhs = self.deref_string(src2, constants, heap);
592 self.set_reg(dest, if op(lhs, rhs) { 1 } else { 0 });
593 self.pc += 1;
594 }
595
596 /// Implements the `AddDouble` opcode.
597 pub(super) fn do_add_double(&mut self, instr: u32) {

Callers 6

do_equal_textMethod · 0.80
do_greater_equal_textMethod · 0.80
do_greater_textMethod · 0.80
do_less_equal_textMethod · 0.80
do_less_textMethod · 0.80
do_not_equal_textMethod · 0.80

Calls 3

parseFunction · 0.85
set_regMethod · 0.80
deref_stringMethod · 0.45

Tested by

no test coverage detected