Advertisement
UnrestrainedGTA

mod Float(Int)

Oct 5th, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. alloc(ConvertRoutine,1024)
  2. alloc(ConvertBackRoutine,1024)
  3. alloc(TypeName,256)
  4. alloc(ByteSize,4)
  5. alloc(UsesFloat,1)
  6. alloc(CallMethod,1)
  7.  
  8. TypeName:
  9. db 'mod Float(Int)',0
  10.  
  11. ByteSize:
  12. dd 4
  13.  
  14. UsesFloat:
  15. db 1
  16.  
  17. CallMethod:
  18. db 1
  19.  
  20. ConvertRoutine:
  21. [64-bit]
  22. mov eax,[rcx]
  23. [/64-bit]
  24.  
  25. [32-bit]
  26. mov eax,[esp+4]
  27. mov eax,[eax]
  28. [/32-bit]
  29.  
  30. movd xmm0,eax
  31. cvtps2dq xmm1,xmm0 // convert single to integer
  32. cvtdq2ps xmm1,xmm1 // convert integer to single
  33.  
  34. ucomiss xmm0,xmm1
  35. je @f
  36. mov eax,7FC00000 // NaN
  37.  
  38. @@:
  39. ret
  40.  
  41.  
  42. ConvertBackRoutine:
  43. [64-bit]
  44. movd xmm0,ecx
  45. cvtps2dq xmm0,xmm0 // convert single to integer
  46. cvtdq2ps xmm0,xmm0 // convert integer to single
  47. movss [r8],xmm0
  48. [/64-bit]
  49.  
  50. [32-bit]
  51. push ebp
  52. mov ebp,esp
  53. push eax
  54. push ebx
  55. mov eax,[ebp+8]
  56. mov ebx,[ebp+10]
  57. movd xmm0,eax
  58. cvtps2dq xmm0,xmm0 // convert single to integer
  59. cvtdq2ps xmm0,xmm0 // convert integer to single
  60. movss [ebx],xmm0
  61. pop ebx
  62. pop eax
  63. pop ebp
  64. [/32-bit]
  65.  
  66. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement