BitXor

Use this function to return the result of a bitwise exclusive OR operation performed on two numeric values.

Syntax

BitXor(Value1, Value2)

The parameters specify the numeric values on which the bitwise XOR operation is performed. If either parameter is not an integer, it will be converted to an integer before the bitwise XOR operation is performed.

The bitwise exclusive OR operation compares each bit of value1 to the corresponding bit of value2. If one bit is zero (0) and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to zero (0). Note that integer values have 32 bits to compare.

The following table shows the result of a bitwise XOR (exclusive OR) operation:

Value1 bit

Value2 bit

Result bit

0

   

0

1

1

1

1

0

1

 

1

Example

Here is an example:

x = 3 (3 is 0011 in binary)

y = 6 (6 is 0110 in binary)

 

z = BitXor(x,y)

z = 5 (5 is 0101 in binary)

See also