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: Fix modulo operator for comptime values #1361

Merged
merged 1 commit into from
May 18, 2023
Merged

Conversation

guipublic
Copy link
Contributor

@guipublic guipublic commented May 17, 2023

Related issue(s)

Resolves #1346
Resolves #774

Description

Summary of changes

Use the operands type during modulo simplification

Dependency additions / changes

Test additions / changes

regression test added to 2_div

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

@guipublic guipublic changed the title fix: use integer type for modulo simplification fix(1346): use integer type for modulo simplification May 17, 2023
@TomAFrench TomAFrench changed the title fix(1346): use integer type for modulo simplification fix: fix modulo operator for comptime values May 17, 2023
@TomAFrench TomAFrench changed the title fix: fix modulo operator for comptime values fix: Fix modulo operator for comptime values May 17, 2023
@TomAFrench
Copy link
Member

Using the prefix fix(1346) will add a new scope to the changelog for a single issue number which we don't want.

Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

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

The regression test does not include a for-loop, I have no reason to believe that it will not work, when the constants are from the for-loop, though a quick check on those programs in the linked issues should be done to ensure that it does indeed resolve them

@TomAFrench
Copy link
Member

I can confirm this addresses the for-loop issue as well.

@TomAFrench TomAFrench added this pull request to the merge queue May 17, 2023
Merged via the queue into master with commit ba15d6d May 18, 2023
@TomAFrench TomAFrench deleted the gd/issue_1346 branch May 18, 2023 00:37
TomAFrench added a commit that referenced this pull request May 18, 2023
* master:
  fix: Fix modulo operator for comptime values (#1361)
  chore: clarify that `verify_signature` takes a hashed message (#1365)
  feat: pass in closure to `Driver` to signal backend opcode support (#1349)
  feat(nargo)!: retire print-acir in favour of flag (#1328)
  chore(ssa): enable cse for assert (#1350)
  chore(ssa refactor): Add basic instruction simplification (#1329)
  chore(noir): Release 0.6.0 (#1279)
TomAFrench added a commit that referenced this pull request May 18, 2023
* master:
  fix: Fix modulo operator for comptime values (#1361)
  chore: clarify that `verify_signature` takes a hashed message (#1365)
  feat: pass in closure to `Driver` to signal backend opcode support (#1349)
  feat(nargo)!: retire print-acir in favour of flag (#1328)
  chore(ssa): enable cse for assert (#1350)
  chore(ssa refactor): Add basic instruction simplification (#1329)
  chore(noir): Release 0.6.0 (#1279)
TomAFrench added a commit that referenced this pull request May 18, 2023
* master:
  fix: Fix modulo operator for comptime values (#1361)
  chore: clarify that `verify_signature` takes a hashed message (#1365)
  feat: pass in closure to `Driver` to signal backend opcode support (#1349)
  feat(nargo)!: retire print-acir in favour of flag (#1328)
  chore(ssa): enable cse for assert (#1350)
  chore(ssa refactor): Add basic instruction simplification (#1329)
  chore(noir): Release 0.6.0 (#1279)
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.

Modulo operator is not working Using modulus on comptime values within a for-loop always returns 0
3 participants