When I manualy compare [rcx] (that holds 61 in float) to (float)61 it passes the compare without a problem:
but when I'm doing compare to a register that is 61 in float the check fails:
What am I doing wrong?
cmp [rcx],(float)61 vs cmp [rcx],rbx, different result
Re: cmp [rcx],(float)61 vs cmp [rcx],rbx, different result
One issue is that rbx is a 64 bit register, so it will compare the upper 32bits of rbx against the bits that are in memory pointed at by rcx. You should compare it against a 32bit register instead:
Code: Select all
cmp [rcx], ebx
Re: cmp [rcx],(float)61 vs cmp [rcx],rbx, different result
I strongly suggest using SSE/SSE2 instructions, as we're in 2023:
You can safely use xmm10...xmm15, as I doubt you'll find a game/program with functions that have that many args.
Code: Select all
code:
xorps xmm14,xmm14 // if you wanna have it clean, although it doesn't matter
movss xmm14,[myFloat]
cmpss xmm14,[rcx]
jne bla
myFloat:
dd (float)2.0
Who is online
Users browsing this forum: No registered users