(
&mut self,
vm: &VirtualMachine,
op: impl FnOnce(&BigInt, &BigInt) -> BigInt,
deopt_op: bytecode::BinaryOperator,
)
| 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. |
no test coverage detected