Evaluated left shifts rotate instead of dropping bits

#111 · closed · 2 comments

View on GitHub ↗

twhitehead

``` module Example where import Data.Int.Bits (shl) example :: Int example = shl 1 35 ``` gives ``` const example = 8; export {example}; ```

Comments

natefaubion

This is just how shl (`<<`) works in JavaScript (and thus Data.Integer). I don't think there's anything to be done here.

twhitehead

Right. I see the effect is not that it is a rotation, but rather that the shift amount is mod 32. If memory serves correctly, that might actually be how the assembler instructions work as well.