The MVBITS subroutine copies a sequence of bits from one INTEGER data object to another.

## Syntax

MVBITS (from,frompos,len,to,topos)

*from* is an INTENT(IN) scalar or array of type INTEGER.

*frompos* is an INTENT(IN) scalar or array of type INTEGER. It must be non-negative. *frompos* + *len* must be less than or equal to BIT_SIZE(*from*).

*len* is an INTENT(IN) scalar or array of type INTEGER. It must be non-negative.

*to* is an INTENT(IN OUT) scalar or array of type INTEGER with the same kind as *from*. It can be the same variable as *from*.

*topos* is an INTENT(IN) scalar or array of type INTEGER and must be non-negative. *topos* + *len* must be less than or equal to BIT_SIZE(*to*).

*to* is set by copying *len* bits, starting at position *frompos*, from *from*, to *to*, starting at position *topos*.

If any of from, *from*pos, *len* or *topos* are arrays, *to* must be an array with the same shape.

If *to* is an array, its value is as if the scalar MVBITS operation were performed on each corresponding element of any array arguments.

## Example

integer :: i; data i/z'0f0f'/ integer :: ia(2)=(/2,4/),ja(2) write(*,"(b32)") i ! writes 111100001111 call mvbits(i,0,4,i,4) write(*,"(b32)") i ! writes 111111111111 call mvbits(i,ia,4,ja,ia) write(*,"(b32)") ja ! writes 111100 ! writes 11110000