On 2024-04-20 @prestwich wrote in 46fc569 “Merge pull request #366 from DaniPopes/perfington1”:
Replace with u64::borrowing_sub once stable.
/// whether an arithmetic overflow would occur. If an overflow would have
/// occurred then the wrapped value is returned.
#[inline]
#[must_use]
pub const fn overflowing_sub(mut self, rhs: Self) -> (Self, bool) {
// TODO: Replace with `u64::borrowing_sub` once stable.
#[inline]
const fn u64_borrowing_sub(lhs: u64, rhs: u64, borrow: bool) -> (u64, bool) {
let (a, b) = lhs.overflowing_sub(rhs);
let (c, d) = a.overflowing_sub(borrow as u64);
(c, b || d)
On 2024-04-20 @prestwich wrote in
46fc569
“Merge pull request #366 from DaniPopes/perfington1”:Replace with
u64::borrowing_sub
once stable.From
src/add.rs:101