How exactly do you use the fabs instruction, or is that outdated? Is it better to use something else (i.e. your own function or macro) to get an absolute value?
I didnt look up in my asm book, but I think it does simply:
st(0) = | st(0) |
st(0) = | st(0) |
I'm pretty sure thats it, of course if you want to write you're own MACRO it would be pretty simple:
fmul st,st
fsqrt
But thats probably over a hundred times slower than fabs :grin:
fmul st,st
fsqrt
But thats probably over a hundred times slower than fabs :grin:
If you have the floating point stored in memory you can do this:
ift only works on real4 floats (not doubles).
If the value is in the FPU stack then use fabs.
mov eax, [floatVal]
and eax, 0x7FFFFFFF
mov [floatVal], eax
ift only works on real4 floats (not doubles).
If the value is in the FPU stack then use fabs.
dxantos, that could would probably work on qwords and even tbytes, just grab the highest four bytes and the sign bit should be in the same place.
Very clever, I'd never have though of it. :alright:
Very clever, I'd never have though of it. :alright:
Why load it into EAX first though? You can operate directly on it
in memory...
in memory...
didn't know that you could 'and' directly on memory variables.