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

Bitwise shifts should mention that only 5 lowest bits of shift value are used #1066

Open
malaire opened this issue Nov 16, 2019 · 1 comment
Labels
breaking would require a MAJOR release request

Comments

@malaire
Copy link

malaire commented Nov 16, 2019

The functions Bitwise.shiftLeftBy, Bitwise.shiftRightBy and Bitwise.shiftRightZfBy only use lowest 5 bits of the shift value.

For example following two commands are equal:

Bitwise.shiftLeftBy  1 10
Bitwise.shiftLeftBy 33 10

This should be mentioned in documentation of these functions.

@evancz evancz added request breaking would require a MAJOR release labels Feb 9, 2021
@evancz
Copy link
Member

evancz commented Feb 9, 2021

Seems like the examples are consistent with the underlying behavior of << in JavaScript and in C.

C at least gives a warning when it sees a integer literal over the sensible limit. Not sure the best course of action on this, but could be a breaking change if the "sensible" option is to check for shifts that would zero everything out and do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking would require a MAJOR release request
Projects
None yet
Development

No branches or pull requests

2 participants