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

9 lines
299 B
Plaintext

# bitwise operators - floating point numbers will be cast to integer
a = 0b00010001
b = 0b11110000
print a
print int(a * 2) # shift left (multiply by 2)
print a \ 2 # shift right (integer divide by 2)
print a | b # bitwise or on two integer values
print a & b # bitwise or on two integer values