(&self, a: &BigInt, b: &BigInt, vm: &VirtualMachine)
| 7083 | /// Int addition with i64 fast path to avoid BigInt heap allocation. |
| 7084 | #[inline] |
| 7085 | fn int_add(&self, a: &BigInt, b: &BigInt, vm: &VirtualMachine) -> PyObjectRef { |
| 7086 | use num_traits::ToPrimitive; |
| 7087 | if let (Some(av), Some(bv)) = (a.to_i64(), b.to_i64()) |
| 7088 | && let Some(result) = av.checked_add(bv) |
| 7089 | { |
| 7090 | return vm.ctx.new_int(result).into(); |
| 7091 | } |
| 7092 | vm.ctx.new_int(a + b).into() |
| 7093 | } |
| 7094 | |
| 7095 | /// Int subtraction with i64 fast path to avoid BigInt heap allocation. |
| 7096 | #[inline] |