ixor 0x82

Bitwise XORs two ints on top of the stack; pushes the result.

Opcode
0x82 (130)
Family
Arithmetic and bitwise
Operands
none
Length
1 byte
Operand stack
…, value1 (int), value2 (int) → …, result (int)
Can throw
nothing at run time (beyond linking errors)

What it does

a ^ b on two ints: pops b, then a, and pushes the result.

It also implements the non-short-circuit boolean operators &, | and ^ on booleans, which are ints. There is no "not" instruction: javac compiles ~x to iconst_m1 and ixor.

How often javac uses it

In JDK 25.0.5's java.base module, ixor appears 998 times in 211 of its 7,391 classes: 0.05% of all instructions, the 108th most common of 194 opcodes in use. Some of the methods that use it: java.io.FilePermissionCollection.implies, java.io.UnixFileSystem.hashCode, java.lang.Boolean.logicalXor, java.lang.FdLibm$IEEEremainder.compute.

Example

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; ixor is highlighted.

static int ints(int a, int b) in Tour, compiled by javac 25
… 23 instructions before
12x = (x << 3) | (x >> 2) ^ (x >>> 1) & 0xff;
24iload_2 // x
27sipush 255
30iand
31ixor
32ior
33istore_2 // x
13return ~x;
34iload_2 // x
36ixor

Open in the viewer

Related instructions

lxor Bitwise XORs two longs on top of the stack; pushes the result.

Specification: JVMS §6.5, ixor (Java SE 25).