RosettaCodeData/Task/Bitwise-operations/BASIC256/bitwise-operations.basic256

9 lines
299 B
Text
Raw Permalink Normal View History

2013-04-10 16:19:29 -07:00
# bitwise operators - floating point numbers will be cast to integer
a = 0b00010001
b = 0b11110000
print a
2016-12-05 22:15:40 +01:00
print int(a * 2) # shift left (multiply by 2)
print a \ 2 # shift right (integer divide by 2)
2013-04-10 16:19:29 -07:00
print a | b # bitwise or on two integer values
print a & b # bitwise or on two integer values