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

fix: simplification of overflowing integer operations #2153

Merged
merged 2 commits into from
Aug 7, 2023
Merged

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Aug 3, 2023

Description

Problem*

Resolves #2045

Summary*

Instead of returning None for operations that will wrap the integer, we use the wrapping_* operations instead. I was worried initially that wrapping on a u128 then truncating afterward would result in a different value than a proper (e.g.) u5::sub operation but after a small amount of testing it seems to work fine.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jfecher
Copy link
Contributor Author

jfecher commented Aug 4, 2023

Also fixes #2098

@jfecher jfecher linked an issue Aug 4, 2023 that may be closed by this pull request
kevaundray
kevaundray previously approved these changes Aug 7, 2023
@kevaundray
Copy link
Contributor

Just pending merge conflict resolution

@jfecher jfecher added this pull request to the merge queue Aug 7, 2023
Merged via the queue into master with commit 4a5d2de Aug 7, 2023
7 checks passed
@jfecher jfecher deleted the jf/fix-2045 branch August 7, 2023 19:21
TomAFrench added a commit that referenced this pull request Aug 7, 2023
* master:
  chore: dumb integration of binary constrain
  fix: Set location before cast instructions in SSA (#2202)
  fix: simplification of overflowing integer operations (#2153)
  feat: Optimize equality checks between a boolean and constant (#2201)
TomAFrench added a commit that referenced this pull request Aug 11, 2023
* master:
  fix: Set location before cast instructions in SSA (#2202)
  fix: simplification of overflowing integer operations (#2153)
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.

Proving phase fails for operations on negative literals Casting negative literals to unsigned doesn't work
3 participants