int opEquals(Object), and other legacy ints (!)
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sun Jul 30 17:14:23 PDT 2006
Bruno Medeiros wrote:
>
> What does the original Eq1 even do? :
>
> sub ECX,0Ch[EDX]
> cmp ECX,1 // Huh?
> sbb EAX,EAX
> neg EAX
>
>
[PS: I've read Frits answer after writing this: ]
Ah I get it now... wasn't understanding what borrow (the mathematical
notion) was, since I'm not a native english speaker. Nothing a wikipedia
lookup didn't solve. So, correct me if I'm wrong:
(when I say EDX I mean 0Ch[EDX] or whatever)
// sets the carry flag if zero flag is on,
// that is, if ECX == EDX (from previous instruction)
cmp ECX,1
// sets EAX as zero and also subtracts one if carry flag is set
// that is, EAX = -1 if ECX == EDX and EAX = 0 if ECX != EDX
sbb EAX,EAX
// two's complement negation of EAX, 0 becomes 0, -1 becomes 1
neg EAX
// end result: EAX = 1 if ECX == EDX and EAX = 0 if ECX != EDX
So yeah, it seems these 3 instructions do the same as SETE ... ?
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-bugs
mailing list