You copied the Doc URL to your clipboard.

Bit manipulation functions and subroutines

Functions and subroutines for manipulating bits.

Bit manipulation functions and subroutines

Intrinsic

Description

Num. of Arguments

Argument Type

Result

AND

Perform a logical AND on corresponding bits of the arguments.

2

Any, except CHAR or COMPLEX

INTEGER or LOGICAL

BIT_SIZE

Return the number of bits (the precision) of the integer argument.

1

INTEGER

INTEGER

BTEST

Test the binary value of a bit in a specified position of an integer argument.

2

INTEGER, INTEGER

LOGICAL

IAND

Perform a bit-by-bit logical AND on the arguments.

2

INTEGER, INTEGER (of same kind)

INTEGER

IBCLR

Clear one bit to zero.

2

INTEGER, INTEGER >=0

INTEGER

IBITS

Extract a sequence of bits.

3

INTEGER, INTEGER >=0, INTEGER >=0

INTEGER

IBSET

Set one bit to one.

2

INTEGER, INTEGER >=0

INTEGER

IEOR

Perform a bit-by-bit logical exclusive OR on the arguments.

2

INTEGER, INTEGER (of same kind)

INTEGER

IOR

Perform a bit-by-bit logical OR on the arguments.

2

INTEGER, INTEGER (of same kind)

INTEGER

ISHFT

Perform a logical shift.

2

INTEGER, INTEGER

INTEGER

ISHFTC

Perform a circular shift of the rightmost bits.

2 or 3

INTEGER, INTEGER

or

INTEGER, INTEGER, INTEGER

INTEGER

LSHIFT

Perform a logical shift to the left.

2

INTEGER, INTEGER

INTEGER

MVBITS

Copy bit sequence.

5

INTEGER(IN), INTEGER(IN), INTEGER(IN), INTEGER(IN, OUT), INTEGER(IN)

N/A

NOT

Perform a bit-by-bit logical complement on the argument.

2

INTEGER

INTEGER

OR

Perform a logical OR on each bit of the arguments.

2

Any except CHAR or COMPLEX

INTEGER or LOGICAL

POPCNT

Return the number of one bits. (F2008)

1

INTEGER or bits

INTEGER

POPPAR

Return the bitwise parity. (F2008)

1

INTEGER or bits

INTEGER

RSHIFT

Perform a logical shift to the right.

2

INTEGER, INTEGER

INTEGER

SHIFT

Perform a logical shift.

2

Any except CHAR or COMPLEX, INTEGER

INTEGER or LOGICAL

XOR

Perform a logical exclusive OR on each bit of the arguments.

2

INTEGER, INTEGER

INTEGER

ZEXT

Zero-extend the argument.

1

INTEGER or LOGICAL

INTEGER

Was this page helpful? Yes No