Chapter 3 Configuring Advanced Expressions: Getting Started 53

Arithmetic Operations for Compound Advanced Expressions

Operator

Description

 

 

number.BITNEG

Returns a number after applying a bitwise logical negation of the

 

number. The following example assumes that numeric.expression

 

returns 12 (binary 1100):

 

numeric.expression.bitneg()

 

The result of applying the BITNEG operator is -11 (a binary

 

1110011, 32 bits total with all ones to the left).

 

The following is another example of an expression that uses a

 

BITNEG. Assume that the expression prior to the BITNEG returns a

 

value of 8:

 

http.req.header(\"test\").contains_index(\"pat1\"

 

).bitneg

 

The result of this expression is -9.

 

A tilde (~) performs a similar function to BITNEG, but takes another

 

expression as an argument rather than an integer.

 

Note that all returned values of less than 32 bits before applying the

 

operator implicitly have zeros to the left to make them 32 bits wide.

number.BITOR

Returns a number after applying a bitwise OR to the integer

(integer)

argument and the current number value. If either value in the bitwise

 

comparison is a 1, the returned value is a 1. The following example

 

assumes that numeric.expression returns 12 (binary 1100):

 

numeric.expression.bitor(10)

 

The binary value of 10 is 1010, and the result of applying the BITOR

 

operator to the entire expression is 14 (binary 1110).

 

The following is another example of an expression that uses a

 

BITOR. Assume that the expression prior to the BITOR returns a

 

value of 8:

 

http.req.header(\"test\").contains_index(\"pat1\"

 

).bitor(8)

 

The result of this expression is 8.

 

A bar () performs a similar function to BITOR, but takes another

 

expression as an argument rather than an integer.

 

Note that all returned values of less than 32 bits before applying the

 

operator implicitly have zeros to the left to make them 32 bits wide.

 

 

Page 67
Image 67
Citrix Systems 9.2 Result of applying the Bitneg operator is -11 a binary, Operator to the entire expression is 14 binary