bitxor ( x y -- z )
Factor handbook > The language > Numbers > Arithmetic > Bitwise arithmetic

Prev:bitor ( x y -- z )
Next:bitnot ( x -- y )


Vocabulary
math

Inputs and outputs
xan integer
yan integer
zan integer


Word description
Outputs a new integer where each bit is set if and only if the corresponding bit is set in exactly one of the inputs.

Examples
USING: math prettyprint ; 0b101 0b10 bitxor .b
0b111

USING: math prettyprint ; 0b110 0b10 bitxor .b
0b100


Notes
This word implements bitwise exclusive or, so applying it to booleans will throw an error. Boolean exclusive or is the xor word.

Definition


Methods