RosettaCodeData/Task/Bitwise-operations/Python/bitwise-operations-2.py
Ingy döt Net 518da4a923 B
2013-04-10 16:19:29 -07:00

8 lines
173 B
Python

# 8-bit bounded shift:
x = x << n & 0xff
# ditto for 16 bit:
x = x << n & 0xffff
# ... and 32-bit:
x = x << n & 0xffffffff
# ... and 64-bit:
x = x << n & 0xffffffffffffffff