Developer Documentation Library > UNICOM Intelligence Function Library > Miscellaneous functions > BitXor
 
BitXor
Performs a bitwise XOR (exclusive OR) on two or more numeric values and returns the result.
Syntax
BitXor(<value> [, <value>, ...])
Parameters
<value>
Type: Long
Data value. Separate multiple values by using commas.
(return)
Type: Long
All values exclusively OR-ed together.
Notes
Values are converted to Long before being used. If one or more of them cannot be converted to a long value, an error occurs.
The return value is a number with only the bits set that are set in an odd number of the values. If the current data value is NULL, <value> is 0 and the return value is the combination of the other value arguments. If no other arguments are supplied, the return value is the first value. If only <value> and one other value are supplied, the bits set in the return value are those bits that are set in <value> or in the other value, but not in both.
This function is similar to using Xor as a bitwise operator in Visual Basic.
Example
BitXor can be used for reversing certain bits in a bit pattern. Like the other bit functions, BitXor, is useful when working with properties that store a numeric value in which the bits are used to record true or false values that represent whether various flags have been set. Typically a type definition is used to define the various flags. However, be aware that switching bits on and off individually is not generally recommended when using the bit field properties in the UNICOM Intelligence object models.
This mrScriptBasic example clears the bit that represents the vtFilter usage type constant if it is set and sets it if it is not set:
MyVariable.UsageType = BitXor(MyVariable.UsageType, VariableUsageConstants.vtFilter)
See also
BitAnd
Miscellaneous functions