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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

MVBITS

Elemental Intrinsic Subroutine (Generic): Copies a sequence of bits (a bit field) from one location to another. Intrinsic subroutines cannot be passed as actual arguments.

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.

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 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.

You can also use the following specific routines:

BMVBITS

Arguments from and to must be INTEGER(1).

HMVBITS

Arguments from and to must be INTEGER(2).

IMVBITS

Arguments from and to must be INTEGER(2).

JMVBITS

Arguments from and to must be INTEGER(4).

KMVBITS

Arguments from and to must be INTEGER(8).

Example

If TO has the initial value of 6, its value after a call to MVBITS(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