xor在计算机上是什么意思

来源:百度知道 编辑:UC知道 时间:2024/09/22 12:31:18

汇编语言中的异或。用于单片机C51中。电路表示则为异或门。

逻辑运算子

运算子 说明 范例 ?
not 否 not (1+1=3)
and 且 x>0 and x<100
or 或 y<0 or y>100
xor
Example code : Illustrate both types of Xor usage
var
num1, num2, num3 : Integer;
letter : Char;

begin
num1 := $25; // Binary value : 0010 0101 $25
num2 := $32; // Binary value : 0011 0010 $32
// XOr'ed value : 0001 0111 = $17
letter := 'G';
// And used to return a Boolean value
if (num1 > 0) Xor (letter = 'G')
then ShowMessage('Only one of the values is true')
else ShowMessage('Both values are true or false');
// And used to perform a mathematical Xor operation
num3 := num1 Xor num2;
// Display the result
ShowMessageFmt('$25 Xor $32 = $%x',[num3]);
end;

Show full unit code
Both values ar