Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alloc(ConvertRoutine,1024)
- alloc(ConvertBackRoutine,1024)
- alloc(TypeName,256)
- alloc(ByteSize,4)
- alloc(PreferedAlignment,4)
- alloc(UsesFloat,1)
- alloc(CallMethod,1)
- TypeName:
- db 'mod Double(Int)',0
- ByteSize:
- dd 8
- PreferedAlignment:
- dd 4
- UsesFloat:
- db 1
- CallMethod:
- db 1
- ConvertRoutine:
- [64-bit]
- movsd xmm0,[rcx]
- [/64-bit]
- [32-bit]
- mov eax,[esp+4]
- movsd xmm0,[eax]
- [/32-bit]
- cvtsd2ss xmm0,xmm0 // convert double to single
- movd eax,xmm0
- cvtps2dq xmm1,xmm0 // convert single to integer
- cvtdq2ps xmm1,xmm1 // convert integer to single
- ucomiss xmm0,xmm1
- je @f
- mov eax,7FC00000 // NaN
- @@:
- ret
- ConvertBackRoutine:
- [64-bit]
- movd xmm0,ecx
- cvtps2dq xmm0,xmm0 // convert single to integer
- cvtdq2ps xmm0,xmm0 // convert integer to single
- cvtss2sd xmm0,xmm0 // convert single to double
- movsd [r8],xmm0
- [/64-bit]
- [32-bit]
- push ebp
- mov ebp,esp
- push eax
- push ebx
- mov eax,[ebp+8]
- mov ebx,[ebp+10]
- movd xmm0,eax
- cvtps2dq xmm0,xmm0 // convert single to integer
- cvtdq2ps xmm0,xmm0 // convert integer to single
- cvtss2sd xmm0,xmm0 // convert single to double
- movsd [ebx],xmm0
- pop ebx
- pop eax
- pop ebp
- [/32-bit]
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement