IBCHNG

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

Syntax

result = IBCHNG (i, pos)

i
(Input) Must be of type 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 is the same as i. The result is equal to i with the bit in position pos reversed.

For more information, see Bit Functions.

See Also

BTEST, IAND, IBCLR, IBSET, IEOR, IOR, ISHA, ISHC, ISHL, ISHFT, NOT

Example

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