MCPcopy Index your code
hub / github.com/RustPython/RustPython / execute_binary_op_int

Method execute_binary_op_int

crates/vm/src/frame.rs:8133–8153  ·  view source on GitHub ↗
(
        &mut self,
        vm: &VirtualMachine,
        op: impl FnOnce(&BigInt, &BigInt) -> BigInt,
        deopt_op: bytecode::BinaryOperator,
    )

Source from the content-addressed store, hash-verified

8131 /// Fallback to generic binary op if either operand is not an exact int.
8132 #[inline]
8133 fn execute_binary_op_int(
8134 &mut self,
8135 vm: &VirtualMachine,
8136 op: impl FnOnce(&BigInt, &BigInt) -> BigInt,
8137 deopt_op: bytecode::BinaryOperator,
8138 ) -> FrameResult {
8139 let b = self.top_value();
8140 let a = self.nth_value(1);
8141 if let (Some(a_int), Some(b_int)) = (
8142 a.downcast_ref_if_exact::<PyInt>(vm),
8143 b.downcast_ref_if_exact::<PyInt>(vm),
8144 ) {
8145 let result = op(a_int.as_bigint(), b_int.as_bigint());
8146 self.pop_value();
8147 self.pop_value();
8148 self.push_value(vm.ctx.new_bigint(&result).into());
8149 Ok(None)
8150 } else {
8151 self.execute_bin_op(vm, deopt_op)
8152 }
8153 }
8154
8155 /// Execute a specialized binary op on two float operands.
8156 /// Fallback to generic binary op if either operand is not an exact float.

Callers 1

execute_instructionMethod · 0.80

Calls 7

top_valueMethod · 0.80
nth_valueMethod · 0.80
as_bigintMethod · 0.80
pop_valueMethod · 0.80
push_valueMethod · 0.80
new_bigintMethod · 0.80
execute_bin_opMethod · 0.80

Tested by

no test coverage detected