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

ID 767251
Date 7/13/2023
Public

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

Document Table of Contents

IEOR

Elemental Intrinsic Function (Generic): Performs an exclusive OR on corresponding bits. This function can also be specified as XOR or IXOR.

result = IEOR (i,j)

i

(Input) Must be of type integer, logical (which is treated as an integer), or a binary, octal, or hexadecimal literal constant.

j

(Input) Must be of type integer or logical, or a binary, octal, or hexadecimal literal constant.

If both i and j are of type integer or logical, they must have the same kind type parameter. If the kinds of i and j do not match, the value with the smaller kind is extended with its sign bit on the left and the larger kind is used for the operation and the result. i and j must not both be binary, octal, or hexadecimal literal constants.

Results

The result is the same as i if i is of type integer or logical; otherwise, the result is the same as j. If either i or j is a binary, octal, or hexadecimal literal constant, it is first converted as if by the intrinsic function INT to type integer with the kind type parameter of the other.

The result value is derived by combining i and j bit-by-bit according to the following truth table:

  i   j   IEOR (i, j)
  1   1        0
  1   0        1
  0   1        1
  0   0        0

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

BIEOR1

INTEGER(1)

INTEGER(1)

IIEOR2

INTEGER(2)

INTEGER(2)

JIEOR3

INTEGER(4)

INTEGER(4)

KIEOR

INTEGER(8)

INTEGER(8)

1Or BIXOR

2Or HIEOR, HIXOR, or IIXOR

3Or JIXOR

Example

IEOR (12, 7) has the value 11; binary 1100 exclusive OR with binary 0111 is binary 1011.

The following shows another example:

INTEGER I
I = IEOR(240, 90)  ! returns 170
                   ! IEOR (B'11110000', B'1011010') == B'10101010'

The following shows an example using alternate option XOR:

 INTEGER i, j, k
 i = 3             ! B'011'
 j = 5             ! B'101'
 k = XOR(i, j)     ! returns 6 = B'110'