rotateLeft

Rotate x left by n bits.

Should compile to a single CPU instruction (ROL).

TODO: core.bitop.rol instead.

@safe pure nothrow @nogc
ulong
rotateLeft
(
const scope ulong x
,
const scope uint n
)

Examples

assert(rotateLeft(ulong.max, 1) == ulong.max);
assert(rotateLeft(1UL, 1) == 2);
assert(rotateLeft(2UL, 2) == 8);
assert(rotateLeft(3UL, 3) == 24);
assert(rotateLeft(2UL^^63, 1) == 1);

Meta