Wednesday, 1 February 2017

How to convert the integer value to double

Assembly Language - Convert a Decimal to Double value

With CVTSI2SD (if you mean integer).
Eg.

CVTSI2SD xmm0,[ebx+00000458]

will convert the value on [ebx+00000458] to double and save it on xmm0.

It is up to you to save and restore xmm0 before you use it. Eg.

globalalloc(tempstore,8)
globalalloc(tempstore2,8)

newmem: //this is allocated memory, you have read,write,execute access
movss [tempstore],xmm0 //save original value of xmm0
CVTSI2SD xmm0,[ebx+00000458] //convert value
movsd [tempstore2],xmm0 //save the converted double value
movss xmm0,[tempstore] //restore xmm0

Maybe you have to use movsd to save/restore xmm0 but maybe it is not even used at the point where you use it so it depends on the process.

originalcode:
sub [ebx+00000458],eax


But if you just want to define a static value as double, then

tempstore2:
(double) 100



No comments:

Post a Comment

Note: only a member of this blog may post a comment.


Get paid to share your links!