## 9.3.75 ISHFT (I, SHIFT)

Description: | Performs a logical shift.
Class: | Elemental function; Generic
Arguments: | I | Must be of type integer.
| SHIFT | Must be of type integer. The absolute value for SHIFT must be less than or equal to BIT_SIZE (I).
Results: | The result type is the same as I. The result has the value obtained by shifting the bits of I by SHIFT positions. If SHIFT is positive1, the shift is to the left; if SHIFT is negative2, the shift is to the right. If SHIFT is zero, no shift is performed. Bits shifted out from the left or from the right, as appropriate, are lost. Zeros are shifted in from the opposite end. For more information on bit functions, see Section 9.2.3. The model for the interpretation of an integer value as a sequence of bits is shown in Section D.3.
1 ISHFT with a positive SHIFT can also be specified as LSHIFT. 2 ISHFT with a negative SHIFT can also be specified as RSHIFT with |SHIFT|.

Specific Name | Argument Type | Result Type
--- | --- | ---
| INTEGER(1) | INTEGER(1)
IISHFT | INTEGER(2) | INTEGER(2)
JISHFT | INTEGER(4) | INTEGER(4)
KISHFT | INTEGER(8) | INTEGER(8)

Examples

ISHFT (2, 1) has the value 4.

ISHFT (2, -1) has the value 1.

Previous Page Next Page Table of Contents