Bitwise rotate of integral

H. S. Teoh hsteoh at
Mon Jan 7 23:20:57 UTC 2019

On Mon, Jan 07, 2019 at 11:13:37PM +0000, Guillaume Piolat via Digitalmars-d-learn wrote:
> On Monday, 7 January 2019 at 14:39:07 UTC, Per Nordlöw wrote:
> > What's the preferred way of doing bitwise rotate of an integral
> > value in D?
> > 
> > Are there intrinsics for bitwise rotation available in LDC?
> Turns out you don't need any:
> Generates ROL instruction.

There's a certain pattern that dmd looks for, that it transforms into a
ROL instruction. Similarly for ROR.  Deviate too far from this pattern,
though, and it might not recognize it as it should.  To be sure, always
check the disassembly.


I don't trust computers, I've spent too long programming to think that they can get anything right. -- James Miller

More information about the Digitalmars-d-learn mailing list