isha

Date:

10-12-2011

NAME

ISHA, IISHA, JISHA, KISHA - Perform arithmetic shift on an integer

SYNOPSIS

ISHA ([I=]i, [SHIFT=]shift)
IISHA ([I=]i, [SHIFT=]shift)
JISHA ([I=]i, [SHIFT=]shift)
KISHA ([I=]i, [SHIFT=]shift)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran extensions

DESCRIPTION

The ISHA, IISHA, JISHA, KISHA intrinsic functions perform an arithmetic shift of an integer, left or right, by a specified number of bits. This function accepts the following arguments:

i

The integer value shifted. For IISHA, must be of type INTEGER(KIND=2). For JISHA, must be of type INTEGER(KIND=4). For KISHA, must be of type INTEGER(KIND=8).

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 and cannot be passed as arguments.

RETURN VALUES

The result type and type parameter are the same as i. The result is equal to i shifted arithmetically by shift bits.

Bits shifted out, from the left or from the right, are lost. Zeros are shifted in for a left shift. The sign bit is extended for a right shift.

The kind of the integer is important because the sign varies among integer representations. If you want to shift a 1-byte or 2-byte argument, declare it as KIND=1 or KIND=2.