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

Method int_sub

crates/vm/src/frame.rs:7097–7105  ·  view source on GitHub ↗
(&self, a: &BigInt, b: &BigInt, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

7095 /// Int subtraction with i64 fast path to avoid BigInt heap allocation.
7096 #[inline]
7097 fn int_sub(&self, a: &BigInt, b: &BigInt, vm: &VirtualMachine) -> PyObjectRef {
7098 use num_traits::ToPrimitive;
7099 if let (Some(av), Some(bv)) = (a.to_i64(), b.to_i64())
7100 && let Some(result) = av.checked_sub(bv)
7101 {
7102 return vm.ctx.new_int(result).into();
7103 }
7104 vm.ctx.new_int(a - b).into()
7105 }
7106
7107 #[cold]
7108 fn setup_annotations(&mut self, vm: &VirtualMachine) -> FrameResult {

Callers 1

execute_bin_opMethod · 0.80

Calls 1

new_intMethod · 0.45

Tested by

no test coverage detected