fixedint icon indicating copy to clipboard operation
fixedint copied to clipboard

Feature Request: Add `>>>` Unsigned Right Shift Operator

Open seanlaw opened this issue 2 years ago • 1 comments

Hello @nneonneo, would it be possible to add an unsigned right shift operator? >>> to the set of existing bit shifting operations? Thank you for your consideration!

seanlaw avatar Aug 17 '23 14:08 seanlaw

There is no such operator in Python. The easiest option is to use an unsigned operand; for example:

x = Int32(-5)
# signed operation
print(x >> 1)
# unsigned operation
print(Int32(UInt32(x) >> 1))

nneonneo avatar Aug 17 '23 15:08 nneonneo