RosettaCodeData/Task/Bitwise-operations/Logo/bitwise-operations-1.logo

12 lines
361 B
Plaintext

to bitwise :a :b
(print [a and b:] BitAnd :a :b)
(print [a or b:] BitOr :a :b)
(print [a xor b:] BitXor :a :b)
(print [not a:] BitNot :a)
; shifts are to the left if positive, to the right if negative
(print [a lshift b:] LShift :a :b)
(print [a lshift -b:] LShift :a minus :b)
(print [-a ashift -b:] AShift minus :a minus :b)
end
bitwise 255 5