BIT_XOR macro

The BIT_XOR macro is available in Unica Campaign and Unica Interact.

Syntax

data1 BIT_XOR data2

Parameters

data1

The non-negative integers to bitwise XOR with the values in data2. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your product.

data2

The non-negative integer(s) to bitwise XOR with the values in data1. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. The number of columns in data2 must equal the number of columns in data1, unless data2 is a constant. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your product.

Description

BIT_XOR performs a bitwise XOR between the two specified data ranges. It returns a new column for each input column, each containing the corresponding column in data1 bitwise XOR-ed to the corresponding column of data2 (that is, the first column of data1 is bitwise XOR-ed to the first column of data, the second column with the second column, and so on).

If data2 is a constant, each value in data1 is bitwise XOR-ed by that value. If data2 contains one or more columns, the calculations are performed on a row-by-row basis between one column from data2 and one column from data2. The first row of data1 is bitwise XOR-ed to the first row value of data2, the second row with the second row, and so on. This row-by-row calculation produces a result for each row up to the last value of the shortest column.

Note: Precision for this macro function is limited to integer values less than . No negative values are allowed.

Examples

TEMP = 3 BIT_XOR 7

Creates a new column named TEMP containing the value four (bitwise XOR of 011 and 111 equals 100).

TEMP = V1 BIT_XOR 8

Creates a new column named TEMP, where each value is the contents of column V1, bitwise XOR-ed with the binary value 1000.

TEMP = V1 BIT_XOR V1

Creates a new column named TEMP containing all zeros (every value XOR-ed with itself produces zero).

TEMP = V1 BIT_XOR V2

Creates a new column named TEMP, where each value is the row value of column V1 bitwise XOR-ed with the corresponding row value of column V2.

TEMP = V1:V3 BIT_XOR V4:V6

Creates three new columns named TEMP, VX, and VY. The column TEMP contains the values in V1 bitwise XOR-ed with the corresponding row values of column V4. The column VX contains the bitwise XOR-ed values from columns V2 and V5. The column VY contains the bitwise XOR-ed values from columns V3 and V6.

TEMP = V1[10:20] BIT_XOR V2 or TEMP = V1[10:20] BIT_XOR V2[1:11]

Creates a new column named TEMP, where the first 11 cells contain the bitwise XOR-ed result of the values in rows 10-20 of column V1 by the values in rows 1-11 of column V2. The other cells in TEMP are empty.

Related functions

Function Description
BIT_AND Computes the bitwise AND between two specified data ranges
BIT_NOT Computes the bitwise NOT of the contents of the specified data range
BIT_OR Computes the bitwise OR between two specified data ranges