Advertisement
Guest User

paritet

a guest
Apr 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. .section .text
  2. .globl SetParity
  3. SetParity:
  4. pushl %ebp
  5. movl %esp, %ebp
  6.  
  7. # bez 1 gore
  8. movl 8(%ebp), %ecx # n
  9. andw $0x7fff, (%ecx)
  10.  
  11. # maska - eds, eax - brojac
  12. movw $1, %dx
  13. xorl %eax, %eax
  14.  
  15. # prebrojimo
  16. parity_petlja:
  17. testw %dx, (%ecx)
  18. jz parity_dalje
  19. incl %eax # brojim jedinice
  20.  
  21. #svaka kolona
  22. parity_dalje:
  23. shlw $1, %dx
  24. jnc parity_petlja
  25.  
  26.  
  27. #upis prvoj bita
  28. shlw $1, (%ecx)
  29. shrl $1, %eax
  30. rcrw $1, (%ecx)
  31. parity_kraj:
  32.  
  33. movl $0, %eax
  34. testl $0x8000, (%ecx)
  35. jz kraj
  36. incl %eax
  37.  
  38. kraj:
  39. movl %ebp, %esp
  40. popl %ebp
  41. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement