IBITS(I, POS, LEN)

Purpose

Extracts a sequence of bits.

Class

Elemental function

Argument type and attributes

I
An INTENT(IN) INTEGER
POS
An INTENT(IN) INTEGER. Its value must be nonnegative and POS + LEN must be less than or equal to BIT_SIZE (I).
LEN
An INTENT(IN) INTEGER. Its value must be nonnegative.

Result type and attributes

Same as I.

Result value

The result has the value of the sequence of LEN bits in I beginning at bit POS, right-adjusted and with all other bits zero.

The bits are numbered from 0 to BIT_SIZE(I)-1, from right to left.

Examples

IBITS (14, 1, 3) has the value 7. See Integer bit model.

Specific Name Argument Type Result Type Pass As Arg?
IBITS  1  any integer same as argument yes
Note:
  •  1  IBM extension