IEOR

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

Syntax

result = IEOR (i, j)

i
(Input) Must be of type integer.

j
(Input) Must be of type integer with the same kind parameter as i.

Results

The result type is the same as i. 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
BIEOR 1 INTEGER(1) INTEGER(1)
IIEOR 2 INTEGER(2) INTEGER(2)
JIEOR 3 INTEGER(4) INTEGER(4)
KIEOR 4 INTEGER(8) INTEGER(8)
1 Or BIXOR
2 Or HIEOR, HIXOR, or IIXOR
3 Or JIXOR
4 For compatibility, this specific function can also be specified as IXOR.

See Also

IAND, IOR, NOT

Examples

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 

The following shows an example using alternate option XOR:

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