Performs a bitwise exclusive OR.

Syntax

BITXOR(<expN1>, <expN2>)

<expN1>
<expN2>

Two 32-bit integers

Description

BITXOR( ) compares bits in a numeric value <expN1> with corresponding bits in the numeric value <expN2>. When one (and only one) of two bits in the same position are on (set to 1), the corresponding bit in the returned value is on. In any other case, the bit is off (set to 0).

XOR

0

1

0

0

1

1

1

0

This operation is known as exclusive OR, since one bit (and only one bit) must be set on for the corresponding bit in the returned value to be set on.

Use BITXOR( ) to flip individual bits. Create a bit mask: a 32-bit integer with ones in the bits you want to flip and zeroes in the bits you want to leave alone. Use this bit mask as either one of the parameters to BITXOR( ), and the other parameter as the number that is modified.