Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Replace with u64::borrowing_sub once stable. #368

Open
github-actions bot opened this issue Apr 20, 2024 · 0 comments
Open

add: Replace with u64::borrowing_sub once stable. #368

github-actions bot opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
to do To be done tracker Issue tracked by bot

Comments

@github-actions
Copy link

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)

From src/add.rs:101

@github-actions github-actions bot added to do To be done tracker Issue tracked by bot labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to do To be done tracker Issue tracked by bot
Projects
None yet
Development

No branches or pull requests

1 participant