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?
I just found this ulong rotateLeft(ulong x, ubyte bits) { return (x << bits) | (x >> (64 - bits)); } Questions: - Is this a good implementation for the ulong case? - Should we use >> or >>> ?- What's the preferred type for `bits`, ubyte, or uint or making it a template parameter?