2 ms·
Fun fact about large shifts being undefined. With a 32 bit x, the expression x << b | x >> (32 - b) can be translated to a single "roll x b bits to the left" i
by praptak 11y ago
Fun fact about large shifts being undefined.
With a 32 bit x, the expression x << b | x >> (32 - b) can be translated to a single "roll x b bits to the left" instruction. But it is only possible if >32 shifts are treated as undefined.
- pbsd 11y agoNot true. In fact, modern x86 backends recognize the safe rotation idiom and also translate it to a single ROL instruction: http://goo.gl/NCMEVu http://goo.gl/NCMEVu http://goo.gl/9Ytsz2 http://goo.gl/9Ytsz2 http://goo.gl/vbzHNW http://goo.gl/vbzHNW