MVBITS

Elemental Intrinsic Subroutine: Copies a sequence of bits (a bit field) from one location to another.

Syntax

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

from
(Input) Integer. Can be of any integer type. It represents the location from which a bit field is transferred.

frompos
(Input) Can be of any integer type; it must not be negative. It identifies the first bit position in the field transferred from from. frompos + len must be less than or equal to BIT_SIZE(from).

len
(Input) Can be of any integer type; it must not be negative. It identifies the length of the field transferred from from.

to
(Input; output) Can be of any integer type, but must have the same kind parameter as from. It represents the location to which a bit field is transferred. to is set by copying the sequence of bits of length len, starting at position frompos of from to position topos of to. No other bits of to are altered.

On return, the len bits of to (starting at topos) are equal to the value that len bits of from (starting at frompos) had on entry.

topos
(Input) Can be of any integer type; it must not be negative. It identifies the starting position (within to) for the bits being transferred. topos + len must be less than or equal to BIT_SIZE(to).

For more information, see Bit Functions.

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

You can also use the following specific routines:

IMVBITS All arguments must be INTEGER(2)
JMVBITS Arguments can be INTEGER(2) or INTEGER(4); at least one must be INTEGER(4)
KMVBITS Arguments can be INTEGER(2), INTEGER(4), or INTEGER(8); at least one must be INTEGER(8)

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: BIT_SIZE, IBCLR, IBSET, ISHFT, ISHFTC

Examples

If TO has the initial value of 6, its value after a call to MVBITS with arguments (7, 2, 2, TO, 0) is 5.

The following shows another example:

 INTEGER(1) :: from = 13  ! 00001101
 INTEGER(1) :: to = 6     ! 00000110
 CALL MVBITS(from, 2, 2, to, 0) ! returns to = 00000111
 END