Advertisement
Lexolordan

Untitled

Dec 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1.     .intel_syntax noprefix
  2.     .text
  3.     .global my_sin
  4. my_sin:
  5.     push ebp
  6.     mov ebp, esp
  7.     push ebx
  8.  
  9.     movsd xmm0, [ebp + 8]
  10.  
  11.     mov eax, 0
  12.     cvtsi2sd xmm4, eax
  13.  
  14.     mov eax, 1
  15.     mov ebx, 1
  16.     movsd xmm2, xmm0
  17. Loop:
  18.     movsd xmm6, xmm4
  19.     addsd xmm4, xmm2
  20.  
  21.     mulsd xmm2, xmm0
  22.     mulsd xmm2, xmm0
  23.  
  24.     inc eax
  25.     cvtsi2sd xmm1, eax
  26.     divsd xmm2, xmm1
  27.  
  28.     inc eax
  29.     cvtsi2sd xmm1, eax
  30.     divsd xmm2, xmm1
  31.  
  32.     imul ebx, -1
  33.     cvtsi2sd xmm1, ebx
  34.  
  35.     mulsd xmm2, xmm1
  36.  
  37.     comisd xmm4, xmm6
  38.     jne Loop
  39.  
  40.     sub esp, 8
  41.     movsd [esp], xmm4
  42.     fld qword ptr [esp]
  43.     add esp, 8
  44.  
  45.     pop ebx
  46.     mov esp, ebp
  47.     pop ebp
  48.  
  49.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement