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

Add shift left/right by constant amount #378

Closed
whitequark opened this issue May 5, 2020 · 1 comment
Closed

Add shift left/right by constant amount #378

whitequark opened this issue May 5, 2020 · 1 comment
Labels
Milestone

Comments

@whitequark
Copy link
Member

whitequark commented May 5, 2020

This has several benefits:

  • Parity with Add rotate left/right by constant amount #339;
  • Unlike <</>>, shift_left/shift_right can accept a signed argument without it being a Python compatibility hazard;
  • Unlike <</>>, shift_left/shift_right can return a result that has the exact bit width, as opposed to the most conservative overapproximation. I expect that at some point it will be requested that width inference for <</>> be special-cased for constant amounts, and this is a good way to preempt that.

Note that unlike rotate_{left,right}, shift_{left,right} should return a signed result if the LHS is signed.

@whitequark whitequark added this to the 0.3 milestone May 20, 2020
@whitequark
Copy link
Member Author

Documented in f24f1b0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant