Share via


BITXOR( ) Function

Returns the result of a bitwise exclusive OR operation performed on two numeric values.

BITXOR(nExpression1, nExpression2, , nExpressionN )

Return Values

Numeric

Parameters

  • nExpression1, nExpression2, nExpressionN
    Specifies the numeric values on which the bitwise exclusive OR operation is performed. If nExpression1 and nExpression2 are not integers, they are converted to integers before the bitwise exclusive OR operation is performed.

    Note   A maximum of 26 parameters can be passed.

Remarks

BITAND( ) compares each bit in nExpressionN to the corresponding bit in nExpressionN+1. If the bits in nExpressionN and nExpressionN+1 are both 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0.

The following table shows the result of an exclusive OR operation on corresponding nExpressionN and nExpressionN+1 bits:

nExpressionN bit nExpressionN+1 bit Result bit
0 0 0
0 1 1
1 0 1
1 1 0

Example

x = 5  && 0101 binary
y = 6  && 0110 binary

? BITXOR(x,y) && Returns 3, 0011 binary

See Also

BITAND( ) | BITCLEAR( ) | BITLSHIFT( ) | BITNOT( ) | BITOR( ) | BITRSHIFT( ) | BITSET( ) | BITTEST( )