2 ms·
> (this equality only holds for expressions that are going straight into a Boolean operation Right, though that's more commonly turned into just a cmp instruct
by bonzini 6y ago
> (this equality only holds for expressions that are going straight into a Boolean operation
Right, though that's more commonly turned into just a cmp instruction (a subtraction).
However, if the result is assigned to a variable, on x86 "a != b" would be two or three instructions (possibly clearing a register because setne takes an 8-bit register operand only, and then a cmp/setne pair). Instead the xor would be one instruction, or two if a mov is needed.