rotateRight

fun Long.Companion.rotateRight(i: Long, distance: Int): Long

Returns the value obtained by rotating the two's complement binary representation of the specified long value right by the specified number of bits. (Bits shifted out of the right hand, or low-order, side reenter on the left, or high-order.)

Note that right rotation with a negative distance is equivalent to left rotation: rotateRight(val, -distance) == rotateLeft(val, distance). Note also that rotation by any multiple of 64 is a no-op, so all but the last six bits of the rotation distance can be ignored, even if the distance is negative: rotateRight(val, distance) == rotateRight(val, distance & 0x3F).

Return

the value obtained by rotating the two's complement binary representation of the specified long value right by the specified number of bits.

Since

1.5

Parameters

i

the value whose bits are to be rotated right

distance

the number of bit positions to rotate right