RosettaCodeData/Task/Bitwise-operations/Python/bitwise-operations-2.py

9 lines
173 B
Python
Raw Permalink Normal View History

2013-04-10 16:19:29 -07:00
# 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