Logical functions
The logical functions perform bit operations.
The logical functions are in the Logical category of the
expression editor. Square brackets indicate that an argument is optional. The examples show the
function as it appears in a Derivation field in the Transformer stage.
- BitAnd
- Returns the bitwise AND of the two integer arguments.
- Input: number1 (uint64), number2 (uint64)
- Output: number (uint64)
- Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the
number 400, then the following two functions are equivalent, and return the value
256:
BitAnd(352,400) BitAnd(mylink.mynumber1,mylink.mynumber2)
- BitCompress
- Returns the integer that is made from the string argument, which contains a binary
representation of "1"s and "0"s.
- Input: string
- Output: number (uint64)
- Examples. If mylink.mynumber contains the string "0101100000", then the following two
functions are equivalent, and return the number 352.
BitCompress("0101100000") BitCompress(mylink.mynumber)
- BitExpand
- Returns a string containing the binary representation in "1"s and "0"s of the given integer.
- Input: number (uint64)
- Output: string
- Examples. If mylink.mynumber contains the number 352, then the following two functions
are equivalent, and return the string "0101100000".
BitExpand(352) BitExpand(mylink.mynumber)
- BitOr
- Returns the bitwise OR of the two integer arguments.
- Input: number1 (uint64), number2 (uint64)
- Output: number (uint64)
- Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the
number 400, then the following two functions are equivalent, and return the value
496:
BitOr(352,400) BitOr(mylink.mynumber1,mylink.mynumber2)
- BitXOr
- Returns the bitwise Exclusive OR of the two integer arguments.
- Input: number1 (uint64), number2 (uint64)
- Output: number (uint64)
- Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains the
number 400, then the following two functions are equivalent, and return the value
240:
BitXOr(352,400) BitXOr(mylink.mynumber1,mylink.mynumber2)
- Not
- Returns the complement of the logical value of an expression. If the value of expression is
true, the Not function returns a value of false (0). If the value of expression is false, the NOT
function returns a value of true (1). A numeric expression that evaluates to 0 is a logical value of
false. A numeric expression that evaluates to anything else, other than the null value, is a logical
true. An empty string is logically false. All other string expressions, including strings that
include an empty string, spaces, or the number 0 and spaces, are logically true.
- Input: expression
- Output: complement (int8)
- Examples. If mylink.myexpression contains the expression 5–5, then the following two
functions are equivalent, and return the value 1:
If mylink.myexpression contains the expression 5+5, then the following two functions are equivalent, and return the value 0:Not(5-5) Not(mylink.myexpression)
-
Not(5+5) Not(mylink.myexpression)
- SetBit
- Returns an integer with specific bits set to a specific state, where origfield is the
input value to perform the action on, bitlist is a string containing a list of
comma-separated bit numbers to set the state of, and bitstate is either 1 or 0, indicating
which state to set those bits.
- Input: origfield (uint64),bitlist (string),bitstate (uint8)
- Output: number (uint64)
- Examples. If mylink.origfield contains the number 352, mylink.bitlist contains the list
"2,4,8", and mylink.bitstate contains the value 1, then the following two functions are equivalent,
and return the value 494:
SetBit(356,"2,4,8",1) SetBit(mylink.origfield,mylink.bitlist,mylink.bitstate)