-
Notifications
You must be signed in to change notification settings - Fork 219
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
Add support of bit shifts on signed integers #1479
Comments
Rationale can be written here and we can put it in the code as docs after |
Left and right shift are implemented for non-const unsigned integers in PR #2072 |
we have signed integers implemented, so we can close once we have bit shift implemented for them |
# Description ## Problem\* Resolves #1479 ## Summary\* Add support for bit shifts with signed integers. We use Rust behaviour for overflows. ## 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.
Problem
The previous code seems to have only done a right shift, if the
rhs
was a constant. Moreover, it did an unsigned division.The current code does not handle integer arithmetic, ie overflows etc, so right shifts are doing field divisions instead of integer divisions. This is most likely not the correct route forward.
Happy Case
We should rationalize whether we want shift left and shift right to work only for unsigned integers.
This would mean that both implementation would be doing integer mul and integer division. The previous code was doing Field Mul and integer division.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: