ISHL (integer, shift)
Class: Elemental function - Generic
Logically shifts an integer left or right by the specified bits.
Zeros are shifted in from the opposite end.
The "shift" is of type integer; it is the direction and distance of
shift.
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