Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #setparity program
  2. .section .data
  3. .section .text
  4. .globl SetParity
  5. #int SetParity(unsigned short int* v);
  6. SetParity:
  7. pushl %ebp
  8. movl %esp, %ebp
  9. pushl %ebx
  10. pushl %esi
  11.  
  12. movl 8(%ebp), %esi
  13. andl $0x7fffffff, (%esi)
  14. movl (%esi), %edx
  15.  
  16. pocetak:
  17. movl $0, %eax
  18. movb $0, %cl #broj jedinica
  19.  
  20. petlja:
  21. shll $1, %edx
  22. adcb $0, %cl
  23. adcl $0, %eax
  24. cmpl $0, %edx
  25. jne petlja
  26.  
  27. broj:
  28. movl (%esi), %edx
  29. shrl (%ebx)
  30. jc neparan
  31.  
  32. paran:
  33. andl $0x7fffffff, (%esi) #postavljanje bita pariteta na 0
  34. roll %cl, (%esi)
  35.  
  36. neparan:
  37. orl $0x80000000, (%esi)
  38. rorl %cl, (%esi)
  39.  
  40. kraj:
  41. popl %esi
  42. popl %ebx
  43. movl %ebp, %esp
  44. popl %ebp
  45. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement