Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

IBSET

Elemental Intrinsic Function (Generic): Sets one bit to 1.

result = IBSET (i,pos)

i

(Input) Must be of type integer or of type logical (which is treated as an integer).

pos

(Input) Must be of type integer. It must not be negative and it must be less than BIT_SIZE( i).

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

Results

The result type and kind are the same as i. The result has the value of the sequence of bits of i, except that bit pos of i is set to 1.

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

BBSET

INTEGER(1)

INTEGER(1)

IIBSET1

INTEGER(2)

INTEGER(2)

JIBSET

INTEGER(4)

INTEGER(4)

KIBSET

INTEGER(8)

INTEGER(8)

1Or HBSET.

Example

IBSET (8, 1) has the value 10.

If V has the value (1, 2, 3, 4), the value of IBSET (POS = V, I = 2) is (2, 6, 10, 18).

The following shows another example:

INTEGER I
I = IBSET(8, 2) ! returns 12 = 1100