bit-xor(number)

koadrobot/bits/bit-xor(number)

Computes bitwise XOR of two or more numbers. A resulting bit at a particular position is 1 only if an odd number of corresponding bits of inputs is 1.
bit-xor(number)
@/bit-xor(number)
Computes bitwise XOR of two or more numbers. A resulting bit at a particular position is 1 only if an odd number of corresponding bits of inputs is 1.
IN1number
Input number. Interpreted as a signed 32-bit interger
IN2number (variadic)
bit-xor(number)
IN1
IN2
OUT
OUTnumber
To use the node in your project you should have the koadrobot/bits library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    int32_t in1 = (int32_t)getValue<input_IN1>(ctx);
    int32_t in2 = (int32_t)getValue<input_IN2>(ctx);
    emitValue<output_OUT>(ctx, in1 ^ in2);
}

Tabular tests

IN1IN2OUT
000
011
101
110