ishl

Date:

10-12-2011

NAME

ISHL, IISHL, JISHL, KISHL - Perform logical shift with zero fill

SYNOPSIS

ISHL ([I=]i, [SHIFT=]shift)
IISHL ([I=]i, [SHIFT=]shift)
JISHL ([I=]i, [SHIFT=]shift)
KISHL ([I=]i, [SHIFT=]shift)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran extensions

DESCRIPTION

The ISHL, IISHL, JISHL, KISHL intrinsic functions perform a logical shift on an integer. In this shift, the intrinsic shifts the integer left or right by a specified number of bits. Bits shifted out of one end are lost, and zeros are filled in. These functions accept the following arguments:

i

Must be of type integer. For IISHL, must be of type INTEGER(KIND=2). For JISHL, must be of type INTEGER(KIND=4). For KISHL, must be of type INTEGER(KIND=8). This is the value to be shifted.

shift

Must be of type integer. This is the direction and distance of the shift.

  • Positive shifts are left, toward the most significant bit. Negative shifts are right, toward the least significant bit. If shift is zero, no shift is performed.

These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.

RETURN VALUES

The result type and type parameter are the same as i. The result is equal to i logically shifted by shift bits. Zeros are shifted in from the opposite end.

The integer kind determines the end that the bits are shifted out of. For an INTEGER(KIND=4) argument, 32 bits are shifted. If you want to shift a 1-byte or 2-byte argument, declare it as KIND=1 or KIND=2.