Description: | Copies a sequence of bits (a bit field) from one location to another. | ||
Class: | Elemental subroutine | ||
Arguments: | There are five arguments1: | ||
FROM | Can be of any integer type. It represents the location from which a bit field is transferred. | ||
FROMPOS | 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).2 | ||
LEN | Can be of any integer type; it must not be negative. It identifies the length of the field transferred from FROM. | ||
TO | 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.2 | ||
TOPOS | 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). | ||
1 FROM, FROMPOS, LEN, and TOPOS are INTENT(IN) arguments;
TO is an INTENT(INOUT) argument. For more information on INTENT, see
Section 5.10.
2 The model for the interpretation of an integer value as a sequence of bits is shown in Section D.3. For more information on bit functions, see Section 9.2.3. |
You can also use the following specific subroutines:
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). |
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.