longbool xor
Original Reporter info from Mantis: nanobit @nanobit
-
Reporter name:
Original Reporter info from Mantis: nanobit @nanobit
- Reporter name:
Description:
Boolean operations on longbools should operate logically (non-bitwise).
But xor returns the bitwise xor which can be the negation of the correct result.
var b1, b2, b3: longbool;
b1 := longbool(1); b2 := longbool(2);
b3 := b1 or b2; // gives -1 (True); would be 3 if bitwise
b3 := b1 and b2; // gives -1 (True); would be 0 (False) if bitwise
b3 := not b2; // gives 0 (False); would be -3 (True) if bitwise
b3 := b1 xor b2; // gives 3 (bitwise): dword(b3) := dword(b1) xor dword(b2);
b3 := boolean(b1) xor boolean(b2); // correctly gives 0 (False)
(b1 xor b2) returns True (this says: inputs are different),
xor fails to see that both inputs are logical equal (True, True)
(b1 and b2) correctly says, they are logical equal (True, True).
Mantis conversion info:
- Mantis ID: 35272
- OS: Windows
- OS Build: 10
- Platform: win32
- Version: 3.0.4
- Fixed in version: 3.3.1
- Fixed in revision: 42167 (#eab079c7)