Difference between revisions of "Assembler:Commands:XOR"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Assembler]] | ||
'''command''' xor ''destination'', ''source'' | '''command''' xor ''destination'', ''source'' | ||
Line 16: | Line 17: | ||
Performs a bitwise exclusive OR (XOR) operation on the destination (first) and source (second) operands and stores the result in the destination operand location. The source operand can be an immediate, a register, or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result is 1 if the corresponding bits of the operands are different; each bit is 0 if the corresponding bits are the same. | Performs a bitwise exclusive OR (XOR) operation on the destination (first) and source (second) operands and stores the result in the destination operand location. The source operand can be an immediate, a register, or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result is 1 if the corresponding bits of the operands are different; each bit is 0 if the corresponding bits are the same. | ||
− | [http://x86 | + | [http://c9x.me/x86/html/file_module_x86_id_330.html c9x.me/x86/html/file_module_x86_id_330.html] |
</div> | </div> | ||
Line 62: | Line 63: | ||
xor [SomeSymbol],rax | xor [SomeSymbol],rax | ||
− | + | {{AssemblerCommandSeeAlso}} | |
− | |||
− | |||
− | |||
− | + | {{Template:AssemblerCommandExternalLinks}} | |
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 16:07, 3 January 2018
command xor destination, source
The XOR instruction implements the bitwise XOR operation. The XOR operation sets the resultant bit to 1, if and only if the bits from the operands are different. If the bits from the operands are same (both 0 or both 1), the resultant bit is cleared to 0.
destination = destination ^ source
Example:
| destination: 0101 | | source: 0011 | |------------------------------------| | After XOR -> destination: 0110 |
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.
Performs a bitwise exclusive OR (XOR) operation on the destination (first) and source (second) operands and stores the result in the destination operand location. The source operand can be an immediate, a register, or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result is 1 if the corresponding bits of the operands are different; each bit is 0 if the corresponding bits are the same.
Command Parameters[edit]
Parameter | Description |
---|---|
destination | The destination operand |
source | The source operand |
Examples[edit]
xor al,1
xor ax,1
xor ax,1
xor eax,1
xor rax,1
xor al,al
xor ax,ax
xor ax,ax
xor eax,eax
xor rax,rax
xor [eax],eax
xor [rax],rax
xor [00123ABC],eax
xor [SomeSymbol],rax