XOr

(Engine-Level Function)

Description: Returns the bitwise exclusive OR of its parameters.
Returns: Signed 64-bit integer
Usage: Script or steady state.
Function Groups: Bitwise Operation
Related to: And | Not | Or
Format: XOr(Parm1, Parm2)
Parameters:  
Parm1, Parm2  
Required. Any numeric expressions. If floating point values are supplied, they will be truncated to integers.
Comments:

This function compares the corresponding bits of two values. The result bit is 1 if exactly one of the two bits is 1. The result bit is 0 if both bits are the same (either both 1 or both 0).

This function takes signed 64-bit integers values. If a number is passed outside the range of a signed 64-bit integer, then the function will return invalid. If Value is invalid, the return value is invalid.

(See: Bitwise Parameters & Operations)

Example:

var1 = XOr(0b1100, 0b1010);

The value of var1 will be 0b0110.

A common use of XOr is to reverse the bits. To reverse the bits of a 64-bit signed integer:

64bitReverse = XOr(Input, -1);

To reverse the bits of a 32-bit integer (signed or unsigned):

32bitReverse - XOr(Input, 0xFFFFFFFF);