Hello everyone,
Why this code doesn't work?


mov eax, -1
.IF eax<0
invoke MessageBox, 0, addr SomeMsg, addr SomeMsg, 0
.ENDIF

It works fine when I use CMP and JL. (I think the problem has to do with the difference between JL and JB)
I also tried this:


mov eax, -1
.IF eax<0 && SIGN?
invoke MessageBox, 0, addr SomeMsg, addr SomeMsg, 0
.ENDIF

Can someone explain to me how to make this work?
Thanks in advance.
Posted on 2002-02-13 18:44:54 by dilau
heh,

I have no clue either but this seems to work.. basically it tests if the first bit is 1.

test eax,10000000000000000000000000000000b
jns @F
;here it is a negative number
@@:
;here it is a positive number

It works... that's all what matters to me ;)
I was mumbling and swearing much over the AoA to find that out *g*
Posted on 2002-02-13 18:59:41 by JimmyClif
The trick is to cast the comparison. trty this next time:



mov eax, -1
.IF SDWORD PTR eax<0
invoke MessageBox, 0, addr SomeMsg, addr SomeMsg, 0
.ENDIF



Yeah, I know eas is not a pointer here, but the SDWORD (signed double word) part is true enough.
Posted on 2002-02-13 19:53:41 by Ernie
Simply because -1 = 4294967295
Posted on 2002-02-13 21:13:08 by eet_1024
No it doesnt :grin:

Last i checked, -1 is -1, and 4294967295 is 4294967295.
... even you forgot to cast your expression.

(being annoying)
NaN
Posted on 2002-02-13 21:44:13 by NaN