ishft

Date:

10-12-2011

NAME

ISHFT, IISHFT, JISHFT, KISHFT, LSHIFT, RSHIFT - Perform a logical shift

SYNOPSIS

ISHFT ([I=]i, [SHIFT=]shift)
IISHFT ([I=]i, [SHIFT=]shift)
JISHFT ([I=]i, [SHIFT=]shift)
KISHFT ([I=]i, [SHIFT=]shift)
LSHIFT ([I=]i, [SHIFT=]shift)
RSHIFT ([I=]i, [SHIFT=]shift)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

Fortran extensions: IISHFT, JISHFT, KISHFT, LSHIFT, RSHIFT

DESCRIPTION

The ISHFT, IISHFT, JISHFT, KISHFT, LSHIFT and RSHIFT intrinsic functions perform a logical shift. They accept the following arguments:

i

Must be of type integer. For IISHFT, must be of type INTEGER(KIND=2). For JISHFT, must be of type INTEGER(KIND=4). For KISHFT, must be of type INTEGER(KIND=8).

shift

Must be of type integer. The absolute value of shift must be less than or equal to BIT_SIZE(i).

  • ISHFT with a positive shift argument can also be specified as LSHIFT. ISHFT with a negative shift argument can also be specified as RSHIFT with |shift|.

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

RETURN VALUES

The result type and type parameters are the same as i. The result has the value obtained by shifting the bits of i by shift positions. If shift is positive, the shift is to the left; if shift is negative, the shift is to the right; and if shift is zero, no shift is performed. Bits shifted out from the left or from the right, as appropriate, are lost. Zeros are shifted in from the opposite end.

LSHIFT and RSHIFT return the value of the first argument shifted left or right, respectively, the number of times specified by the shift. Zeros are shifted in.

The bit model defines the interpretation of an integer value as a sequence of bits. For more information on the bit model, see the models(3i) man page.

EXAMPLES

ISHFT(3,1) yields 6.

SEE ALSO

ftn(1)

models(3i)