XenoGuard Documentation

Shift Right

Actions » Programming » Number Operation » Logic » Shift Right 

The action Shift Right moves the bits to the right based on a specified number and stores the number in Result of the result list. The leading bit or bits after moving to the right are filled with zero ("0"). 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 Shift Right 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 number whose bits are to be moved towards the right.

Allowed Context Scopes
 [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Pattern 2
The number of places the bits have to move towards the right.

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

Results:

The action returns the following results:


NAME
DESCRIPTION
Result Contains the shifted number.

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

Warning

The number type set in the action Shift Right 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.
An overflow error can occur if the Result is out of range for its specified data type. For instance, setting pattern 2 with a negative signed value will result in this error type. 

Example 1 (Display a variable's hex value after shifting to the right):

This example moves the bits to the right for the local Hash variable with an Unsigned Number data type. The result is changed from Decimal to Hexadecimal value with the conversion operation and is then output via Write Text.

See other logic operations:

Bit AND
Bit NOT
Bit OR
Bit XOR
Shift Left