ishc

Date:

10-12-2011

NAME

ISHC, IISHC, JISHC, KISHC - Perform circular shift on an integer

SYNOPSIS

ISHC ([I=]i, [SHIFT=]shift)
IISHC ([I=]i, [SHIFT=]shift)
JISHC ([I=]i, [SHIFT=]shift)
KISHC ([I=]i, [SHIFT=]shift)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran extensions

DESCRIPTION

The ISHC, IISHC, JISHC, KISHC intrinsic functions perform a circular shift on an integer. In this shift, the intrinsic rotates the integer, left or right, by a specified number of bits. Bits shifted out of one end are shifted in or the other end. No bits are lost. These functions accept the following arguments:

i

Must be of type integer. For IISHC, must be of type INTEGER(KIND=2). For JISHC, must be of type INTEGER(KIND=4). For KISHC, 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 rotation.

  • 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 rotated by shift bits.

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, respectively.