-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Handle integer overflow/underflow for non-64-bit integers #4707
Conversation
We'll probably need to do something about
The corresponding tests are in |
Yeah we probably need something for the const evaluations too. Are you sure there are no missing operators, what about left shift? |
Noted, will add, thanks.
Yeah, I was going to go over the logical operations as well, probably in a separate PR if any changes are required there, but it also makes sense to do it here in one go. |
Ok, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I think the logical operators should also be in this PR if necessary.
This makes me think we might want to add const fn
as a language construct eventually.
fixes #4646
Description
This PR fixes the linked issue by introducing overflow/underflow checks in the
Add
,Mul
,Sub
stdlib traits implementations for theu8
,u16
andu32
types.Checklist
Breaking*
orNew Feature
labels where relevant.