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: > > https://d.godbolt.org/z/C_Sk_- > > 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. T -- I don't trust computers, I've spent too long programming to think that they can get anything right. -- James Miller