XenoGuard Documentation

Bit AND

Actions » Programming » Number Operation » Logic » Bit AND 

The action Bit AND executes a bitwise AND operation and stores the number in Result of the result list. The following number types are allowed: Signed and Unsigned.


[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. Open the Number Operation node.
  3. In the Logic node, select the Bit AND action.

Parameters:

The action has the following input parameters:


NAME DESCRIPTION
Number Type
Specifies the data type to be used for a number.

Allowed Context Scopes
 [Fixed, Local, Global]
Allowed Values [Signed Number, Unsigned Number]
Pattern 1
The first number.

Allowed Context Scopes
 [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Pattern 2
The second number.

Allowed Context Scopes
 [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]

Results:

The action returns the following results:


NAME
DESCRIPTION
Result Contains the result of the bitwise AND operation.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Number System [Binary, Decimal, Hexadecimal]

Warning The number type set in the action Bit AND determines the data type of its Result even if the variables and/or parameters that were set for patterns 1 and 2 are of different data types.

Remarks:

The Bit AND action performing a bitwise AND operation will display the value of 1 if both patterns have a bit value of 1. The action returns the following results: 

BIT IN PATTERN 1
BIT IN PATTERN 2
BIT IN RESULT
0 0 0
0 1 0
1 0 0
1 1 1

Information The Bit AND action executes the bitwise AND operation that is represented by the two's complement.

Example 1 (Implement bitwise AND for two variables):

This example executes the bitwise AND operation for the local Switch 1 and Switch 2 variables with an Unsigned Number data type. The result is changed from Decimal to Hexadecimal value with the conversion operation and is then output via the Message Box.

See other logic operations:

Bit NOT
Bit OR
Bit XOR
Shift Left
Shift Right