bitwise XOR
z = bitxor(x,y)
:
Given x, y two positive integers, this function returns the decimal number whose the binary form is the XOR of the binary representations of x and y.
// Compute the bitwise XOR of two matrices of doubles.
x = [0 1 0 1];
y = [0 0 1 1];
z = bitxor(x, y)
expected = [0 1 1 1];
// Compute the bitwise XOR of two matrices of integers.
x = `uint8`_([0 1 0 1]);
y = `uint8`_([0 0 1 1]);
z = bitxor(x, y)
// The types of x and y cannot be mixed (error).
x = [0 1 0 1];
y = `uint8`_([0 0 1 1]);
// z = bitxor(x, y)
// 13 is (01101)_2
// 27 is (11011)_2
// XOR is (10110)_2 which is 22.
bitxor(`uint8`_(13), `uint8`_(27))
bitxor(13, 27)