• Returns the number x shifted displacement bits to the right. The number displacement may be any representable integer. Negative displacements shift to the left. In any direction, vacant bits are filled with zeros. In particular, displacements with absolute values higher than 31 result in zero (all bits are shifted out).

    For positive displacements, the following equality holds:

    assert(bit32.rshift(b, displacement) == math.floor(b % 2^32 / 2^displacement))

    This shift operation is what is called logical shift.

    Parameters

    • x: number
    • displacement: number

    Returns number