-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
FieldElement::from<usize>
implementation (#3647)
# Description ## Problem\* Resolves <!-- Link to GitHub Issue --> ## Summary\* While reviewing #3617 it struck me how very verbose it is to create constants in acirgen, if we want to represent an array index we need to do every conversion from `usize -> u128 -> FieldElement -> AcirVar`. This PR shortens this by having `add_constant` accept an `impl Into<FieldElement>` as well as implementing `FieldElement::from<usize>`. We can then feed in usizes directly to `add_constant`. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
1 parent
3680f52
commit 8b7c5aa
Showing
3 changed files
with
25 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters