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::carrying_add once stable. #367

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

add: Replace with u64::carrying_add once stable. #367

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::carrying_add once stable.

    /// an arithmetic overflow would occur. If an overflow would have occurred
    /// then the wrapped value is returned.
    #[inline]
    #[must_use]
    pub const fn overflowing_add(mut self, rhs: Self) -> (Self, bool) {
        // TODO: Replace with `u64::carrying_add` once stable.
        #[inline]
        const fn u64_carrying_add(lhs: u64, rhs: u64, carry: bool) -> (u64, bool) {
            let (a, b) = lhs.overflowing_add(rhs);
            let (c, d) = a.overflowing_add(carry as u64);
            (c, b || d)

From src/add.rs:59

@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