- The xor instruction performs a logical XOR (exclusive OR) operation.
- This is the equivalent to the "^" operator in python:
>>> hex(0x18 ^ 0x7575)
xor destination, value
- The OF and CF flags are cleared
- The SF, ZF, and PF flags are set according to the result
- The state of the AF flag is undefined.
mov eax, 0x18 ;11000 in binary
xor eax, 0x7575 ;111010101110101 in binary
The above example will store 0x756D (111010101101101 in binary) into EAX.
For optimization purposes (it only requires 2 bytes), the xor instruction is often used that way to clear the value of a register:
xor eax, eax ; clears the EAX register