MVBITS intrinsic subroutine
Standard: F77 F90 F95 F2003
  Example Program
<Syntax>

CALL MVBITS ( FROM, FROMPOS, LEN, TO, TOPOS )

FROM : Integer, Intent(In);
FROMPOS : Integer, Intent(In), FROMPOS≥0;
LEN : Integer, Intent(In), LEN≥0;
TO : Integer, same kind as FROM, Intent(InOut);
TOPOS : Integer, Intent(In), TOPOS≥0;

Requirements: MAX(FROMPOS,TOPOS)+LEN≤BIT_SIZE(FROM).

<Semantics>

Bits TOPOS:TOPOS+LEN-1 in TO are set to the value of bits FROMPOS:FROMPOS+LEN-1 in FROM; all other bits in TO are unaffected.

Note that FROM and TO are permitted to be the same variable.

This is an elemental subroutine; if any argument is an array, the TO argument must be an array and all array arguments must have the same shape; the MVBITS operation is executed elementwise.

Note that

    CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)
is equivalent to
    TO = IOR(IAND(TO,NOT(SHIFTL(MASKR(LEN,KIND(TO)),TOPOS))), &
             IAND(FROM,SHIFTL(MASKR(LEN,KIND(FROM)),FROMPOS)))
<Related>
BIT_SIZE intrinsic function, IAND intrinsic function, IBITS intrinsic function, IOR intrinsic function, MASKR intrinsic function, NOT intrinsic function, SHIFTL intrinsic function.