def rot32(w, nLeft):
    """ Rotate 32-bit word left by nLeft or right by -nLeft
        without creating a Python long.
        Timing depends on nLeft but not on w.
    """
    nLeft &= 31
    if nLeft == 0:
        return w
    RRR = (w >> 1 & 2147483647) >> 31 - nLeft
    sLLLLLL = -(1 << 31 - nLeft & w) | 2147483647 >> nLeft & w
    return RRR | sLLLLLL << nLeft
