16 lines
327 B
Plaintext
16 lines
327 B
Plaintext
func bitwise(a, b) {
|
|
|
|
# Make sure they are integers
|
|
a.to_int!;
|
|
b.to_int!;
|
|
|
|
say ('a and b : ', a & b);
|
|
say ('a or b : ', a | b);
|
|
say ('a xor b : ', a ^ b);
|
|
say ('not a : ', ~a);
|
|
say ('a << b : ', a << b); # left shift
|
|
say ('a >> b : ', a >> b); # arithmetic right shift
|
|
}
|
|
|
|
bitwise(14,3)
|