[Issue 1989] opEquals should return bool
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 22 05:33:37 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1989
------- Comment #3 from terranium at yandex.ru 2008-05-22 07:33 -------
here's the link:
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25112.PDF
:)
int areEqual(int op1, int op2)
{ return op1-op2; }
mov eax, [ebp+8]
sub eax, [ebp+12]
; now eax contains 0 if they're equal, this is not what we want.
; negate it
setz al ; 3 bytes, 1 cycle
and eax, 1 ; 3 bytes, 1 cycle
ret 8
using bool:
mov eax, [ebp+8]
cmp eax, [ebp+12]
sete al ; 3 bytes, 1 cycle
ret 8
I can't see efficiency of int used instead of bool.
--
More information about the Digitalmars-d-bugs
mailing list