Shift Right
ActionStep Reference » Programming » Number Operation » Logic » Shift Right
The ActionStep 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.
- Open the Programming node in the Workspace Explorer.
- Open the Number Operation node.
- In the Logic node, select the Shift Right ActionStep.
Parameters:
The ActionStep 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 ActionStep returns the following results:
NAME
|
DESCRIPTION
|
---|---|
Result |
Contains the shifted number. Allowed Context Scopes [Fixed, Local, Global] Allowed Number System [Binary, Decimal, Hexadecimal] |
The number type set in the ActionStep 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.
|
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.