3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
6 # Task: Bitwise operations
7 # SEE: <http://rosettacode.org/wiki/Bitwise_operations>
8 module bitwise_operations
10 fun bitwise
(a
, b
: Int)
12 print
"a and b: { a & b }"
13 print
"a or b: { a | b }"
14 print
"a xor b: { a ^ b }"
16 print
"a << b: { a << b }"
17 print
"a >> b: { a >> b }"
20 if args
.length
>= 2 then
21 bitwise
(args
[0].to_i
, args
[1].to_i
)
23 print
"Usage : ./bitwise_operations X X"