elm/core

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

malaire opened this issue · 1 comments

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.

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.