daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .intel_syntax noprefix
  2.  
  3. .global duljina_vektora_asm
  4.  
  5. duljina_vektora_asm:
  6.  
  7. push ebp /* cdecl prolog */
  8. mov ebp, esp
  9. push ebx
  10.  
  11. mov eax, [ebp+8] /* adresa prvog clana ulaznog polja */
  12. mov ebx, [ebp+12] /* duljina niza */
  13. mov ecx, [ebp+16] /* adresa gdje spremamo rezultat */
  14. mov edx, 0 /* brojač */
  15.  
  16. petlja:
  17. cmp edx, ebx
  18. je kraj
  19. fld DWORD PTR [eax+4*edx]
  20. fld DWORD PTR [eax+4*edx]
  21. fmulp
  22. fadd DWORD PTR [ecx]
  23. fstp DWORD PTR [ecx]
  24. inc edx /* uvećaj brojač */
  25. jmp petlja
  26.  
  27. kraj:
  28. fld DWORD PTR [ecx]
  29. fsqrt
  30. fstp DWORD PTR [ecx]
  31.  
  32. pop ebx
  33. mov esp, ebp
  34. pop ebp
  35.  
  36. ret
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top