Skip to content

Saturating math - #8323

Closed
lilyball wants to merge 2 commits into
rust-lang:masterfrom
lilyball:saturating
Closed

Saturating math#8323
lilyball wants to merge 2 commits into
rust-lang:masterfrom
lilyball:saturating

Conversation

@lilyball

Copy link
Copy Markdown
Contributor

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

Comment threadsrc/libstd/num/num.rs

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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
@borsbors closed this Aug 7, 2013
@brendanzab

Copy link
Copy Markdown
Contributor

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
Fixesrust-lang#8323
---
*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: warn if we find multiple clippy configs
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
8323: Only remember blocks that have a DefMap r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Sign up for freeto 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.

4 participants

@lilyball@brendanzab@thestinger@bors