There isn't a built-in operator for this, but you can easily simulate the >>>
yourself:
>>> def rshift(val, n): return val>>n if val >= 0 else (val+0x100000000)>>n
...
>>> rshift(-1000, 3)
536870787
>>> rshift(1000, 3)
125
The following alternative implementation removes the need for the if
:
>>> def rshift(val, n): return (val % 0x100000000) >> n
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…