ibits

Date:

10-12-2011

NAME

IBITS, IIBITS, JIBITS, KIBITS - Extract a sequence of bits

SYNOPSIS

IBITS ([I=]i [,POS=]pos [,LEN=]len)
IIBITS ([I=]i [,POS=]pos [,LEN=]len)
JIBITS ([I=]i [,POS=]pos [,LEN=]len)
KIBITS ([I=]i [,POS=]pos [,LEN=]len)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

Fortran extensions: IIBITS, JIBITS, KIBITS

DESCRIPTION

The IBITS, IIBITS, JIBITS, and KIBITS intrinsic functions extract a sequence of bits. They accept the following arguments:

i

Must be of type integer. For IIBITS, must be of type integer (KIND=2). For JIBITS, must be of type integer (KIND=4). For KIBITS, must be of type integer (KIND=8).

pos

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

len

Must be of type integer and nonnegative.

These are elemental intrinsic functions. The names of these intrinsics cannot be passed as arguments.

RETURN VALUES

The result type and type parameter are the same as i. 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 bit model defines the model for the interpretation of an integer value as a sequence of bits. For more information on the bit model, see the models(3i) man page.

EXAMPLES

IBITS(14,1,3) yields 7. In this example, the bits are numbered from right to left, so they are extracted from right to left.

SEE ALSO

models(3i)