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

IBCHNG

Elemental Intrinsic Function (Generic): Reverses the value of a specified bit in an integer.

result = IBCHNG (i,pos)

i

(Input) Must be of type integer or of type logical (which is treated as an integer). This argument contains the bit to be reversed.

pos

(Input) Must be of type integer. This argument is the position of the bit to be changed.

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

Results

The result type and kind are the same as i. The result is equal to i with the bit in position pos reversed.

For more information, see Bit Functions.

Example

  INTEGER J, K
  J = IBCHNG(10, 2)     ! returns 14 = 1110
  K = IBCHNG(10, 1)     ! returns 8 = 1000