Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ISHFTC

Elemental Intrinsic Function (Generic): Performs a circular shift of the rightmost bits.

result = ISHFTC (i,shift[,size])

i

(Input) Must be of type integer.

shift

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

size

(Input;optional) Must be of type integer. The value of sizemust be positive and must not exceed BIT_SIZE( i). If sizeis omitted, it is assumed to have the value of BIT_SIZE( i).

Results

The result type and kind are the same as i. The result value is obtained by circular shifting the size rightmost 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. If shift is zero, no shift is performed.

No bits are lost. Bits in i beyond the value specified by size are unaffected.

For more information on bit functions, see Bit Functions.

The model for the interpretation of an integer value as a sequence of bits is shown in Model for Bit Data.

Specific Name

Argument Type

Result Type

BSHFTC

INTEGER(1)

INTEGER(1)

IISHFTC1

INTEGER(2)

INTEGER(2)

JISHFTC

INTEGER(4)

INTEGER(4)

KISHFTC

INTEGER(8)

INTEGER(8)

1Or HSHFTC.

Example

ISHFTC (4, 2, 4) has the value 1.

ISHFTC (3, 1, 3) has the value 6.

The following shows another example:

  INTEGER(1) i, res1
  INTEGER(2) j, res2
  i = 10  ! equal to 00001010
  j = 10  ! equal to 00000000 00001010
  res1 = ISHFTC (i, 2, 3)   ! rotates the 3 rightmost
                            ! bits by 2 (left) and
                            ! returns 00001001 = 9
  res1 = ISHFTC (i, -2, 3)  ! rotates the 3 rightmost
                            ! bits by -2 (right) and
                            ! returns 00001100 = 12
  res2 = ISHFTC (j, 2, 3)   ! rotates the 3 rightmost
                            ! bits by 2 and returns
                            ! 00000000 00001001 = 9

See Also