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

Saturating math #8323

Closed
wants to merge 2 commits into from
Closed

Saturating math #8323

wants to merge 2 commits into from

Conversation

lilyball
Copy link
Contributor

@lilyball lilyball commented Aug 6, 2013

Implement saturating math in std::num::Saturating and use it for Iterator impls

@@ -466,6 +466,56 @@ impl<T: Zero> Zero for ~T {
fn is_zero(&self) -> bool { (**self).is_zero() }
}

/// Saturating math operations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to use static methods here - is there a reason not to use normal methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't like the idea of saying a.saturating_add(b). Just seemed odd to me.

Saturating is an implementation of saturating math operations (at the
moment just add and sub) for integral types.
Replace hand-rolled saturation math with calls to Saturating.

Fix one impl that didn't use saturating math.
@lilyball
Copy link
Contributor Author

lilyball commented Aug 6, 2013

r? @thestinger

bors added a commit that referenced this pull request Aug 7, 2013
Implement saturating math in `std::num::Saturating` and use it for `Iterator` impls
@bors bors closed this Aug 7, 2013
@brendanzab
Copy link
Member

This relates to #4819

flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 10, 2022
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 10, 2022
…xFrednet

warn if we find multiple clippy configs

Fixes rust-lang#8323

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: warn if we find multiple clippy configs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants