Lahey/Fujitsu Fortran

ISHFTC Function

Description

The ISHFTC function performs a circular shift of the rightmost bits of an integer argument.

```Syntax
ISHFTC (i, shift [, size])
```

Required Arguments

i is an INTENT(IN) scalar or array of type INTEGER, containing values to be shifted.

shift is an INTENT(IN) scalar or array of type INTEGER. The absolute value of shift must be less than or equal to size.

Optional Arguments

size is an INTENT(IN) scalar or array of type INTEGER. Only the rightmost size bits will be shifted.

The value of size must be positive and must not be greater than BIT_SIZE(i).

If absent, it is as if size were present with the value BIT_SIZE(i).

Result

The result is of type INTEGER and of the same kind as i.

Its value is equal to the value of i with its rightmost size bits circularly shifted by shift positions.

If shift is positive, bits are shifted to the left.

If shift is negative, bits are shifted to the right.

```Example
integer :: i=16,ia(2)=(/4,8/)
write(*,*) i,ia            ! writes 16  4  8
write(*,*) ishftc(i,-2)    ! writes 4
write(*,*) ishftc(i,ia,8)  ! writes 1 16
write(*,*) ishftc(ia,2)    ! writes 16 32
write(*,*) ishftc(ia,i,16) ! writes 4  8
```