XOR Functions

The XOR (exclusive-OR) functions create a result by combining each bit of one number with the corresponding bit of the other number. If a pair of corresponding bits are the same, the result for that bit position is 0; if they are different, the result is 1, as shown in the table.

XOR

arg1

0

1

arg2

0

0

1

1

1

0

Sample Syntax

INT1XOR(arg1, arg2)

Remarks

The XOR functions are commutative; that is, the order of the arguments does not affect the outcome.

Examples

 

Function Input

Result

Comments

INT1XOR(0,x)

x

0 has no bits set, so every bit set in x is set in the result.

INT1XOR(0,x)

-x

-0 is mapped to 0 before being XORed to arg2.

INT1XOR(-0,-x)

x

-0 is mapped to 0 before being XORed to arg2.

INT1XOR(64,-64)

-128

 

INT1XOR(64,-66)

-2

 

INT1XOR(66,-64)

-126

 

INT1XOR(-66,-64)

126

 

INT1XOR(-1,127)

-128

 

INT1XOR(-128,1)

-127

 

. . .

 

 

INT1XOR(-128,127)

-1

 

INT1XOR(-128,-127)

1

 

. . .

 

 

INT1XOR(-128,-1)

127