Hi All,

https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT

(Operators) infix +^ยง

multi sub infix:<+^>($a, $b --> Int:D)

Integer bitwise XOR operator: Coerces both arguments to Int and does a bitwise XOR (exclusive OR) operation.


$ p6 'my uint8 $x=0b0101_0111; my uint8 $y = 0b0000_1111; my uint8 $z = +^($x, $y ); say "0", $x.base(2); say "0000", $y.base(2); say $z.base(2);'

01010111
00001111
11111101


XOR
A  B   A xor B
0  0      0
1  0      1
0  1      1
1  1      0

That s not what I am seeing above.

What am I doing wrong this time?

And who set the high bit making $z negative?

Many thanks,
-T

Reply via email to