Description: |
Logically shifts an integer left or right by the specified bits. Zeros are shifted in from the opposite end. | ||

Class: |
Elemental function; Generic | ||

Arguments: |
I | Must be of type integer. This argument is the value to be shifted. | |

SHIFT | Must be of type
integer. This argument is the direction and distance of shift.
If positive, I is shifted left (toward the most significant bit). If negative, I is shifted right (toward the least significant bit). | ||

Results: |
The result type is the same as I. The
result is equal to I logically shifted by SHIFT bits. Zeros are
shifted in from the opposite end.
Unlike circular or arithmetic shifts, which can shift ones into the number being shifted, logical shifts shift in zeros only, regardless of the direction or size of the shift. The integer kind, however, still determines the end that bits are shifted out of, which can make a difference in the result (see the following example). |

**Examples**

Consider the following:

```
INTEGER(1) i, res1
INTEGER(2) j, res2
i = 10 ! equal to 00001010
j = 10 ! equal to 00000000 00001010
res1 = ISHL (i, 5) ! returns 01000000 = 64
res2 = ISHL (j, 5) ! returns 00000001 01000000 = 320
```

Previous Page Next Page Table of Contents