Bitwise rotate of integral
Reimer Behrends
behrends at gmail.com
Tue Jan 8 13:38:24 UTC 2019
On Tuesday, 8 January 2019 at 09:15:09 UTC, Patrick Schluter
wrote:
> Are you sure it's dmd looking for the pattern. Playing with the
> godbolt link shows that dmd doesn't generate the rol code (gdc
> 4.8.2 neither).
Looking at the dmd compiler source code, it requires the value to
be rotated to be of a type no larger than an int and the amount
that the value is rotated by to be a constant.
Example: https://d.godbolt.org/z/m3HiPq
Interestingly, if you rotate by exactly 16 bits, it will generate
less optimal code.
More information about the Digitalmars-d-learn
mailing list