( w, nLeft )
return RRR | ( sLLLLLL << 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.
Rotate 32-bit word left by nLeft or right by -nLeft
        without creating a Python long.
        Timing depends on nLeft but not on w.
Rotate 32 - bit word left by nLeft or right by - nLeft without creating a Python long . Timing depends on nLeft but not on w .
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  # which makes nLeft >= 0
    if nLeft == 0:
        return w

    # Note: now 1 <= nLeft <= 31.
    #     RRRsLLLLLL   There are nLeft RRR's, (31-nLeft) LLLLLL's,
    # =>  sLLLLLLRRR   and one s which becomes the sign bit.
    RRR = ( ( ( w >> 1 ) & 0x7fffFFFF ) >> ( 31 - nLeft ) )
    sLLLLLL = -( (1<<(31-nLeft)) & w ) | (0x7fffFFFF>>nLeft) & w
    return RRR | ( sLLLLLL << nLeft )
def rot32 ( w , nLeft ) : nLeft &= 31 # which makes nLeft >= 0 if nLeft == 0 : return w # Note: now 1 <= nLeft <= 31. #     RRRsLLLLLL   There are nLeft RRR's, (31-nLeft) LLLLLL's, # =>  sLLLLLLRRR   and one s which becomes the sign bit. RRR = ( ( ( w >> 1 ) & 0x7fffFFFF ) >> ( 31 - nLeft ) ) sLLLLLL = - ( ( 1 << ( 31 - nLeft ) ) & w ) | ( 0x7fffFFFF >> nLeft ) & w return RRR | ( sLLLLLL << nLeft )