Intel® Fortran Compiler 18.0 Developer Guide and Reference

IBITS

Elemental Intrinsic Function (Generic): Extracts a sequence of bits (a bit field).

result = IBITS (i,pos,len)

i

(Input) Must be of type integer.

pos

(Input) Must be of type integer. It must not be negative and pos+ len must be less than or equal to BIT_SIZE(i).

The rightmost (least significant) bit of i is in position 0.

len

(Input) Must be of type integer. It must not be negative.

Results

The result type and kind are the same as i. The result has the value of the sequence of len bits in i, beginning at pos, right-adjusted and with all other bits zero.

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.

Specific Name

Argument Type

Result Type

BBITS

INTEGER(1)

INTEGER(1)

IIBITS1

INTEGER(2)

INTEGER(2)

JIBITS

INTEGER(4)

INTEGER(4)

KIBITS

INTEGER(8)

INTEGER(8)

1 Or HBITS

Example

IBITS (12, 1, 4) has the value 6.

IBITS (10, 1, 7) has the value 5.

See Also