Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .section .text
- .globl SetParity
- SetParity:
- pushl %ebp
- movl %esp, %ebp
- # bez 1 gore
- movl 8(%ebp), %ecx # n
- andw $0x7fff, (%ecx)
- # maska - eds, eax - brojac
- movw $1, %dx
- xorl %eax, %eax
- # prebrojimo
- parity_petlja:
- testw %dx, (%ecx)
- jz parity_dalje
- incl %eax # brojim jedinice
- #svaka kolona
- parity_dalje:
- shlw $1, %dx
- jnc parity_petlja
- #upis prvoj bita
- shlw $1, (%ecx)
- shrl $1, %eax
- rcrw $1, (%ecx)
- parity_kraj:
- movl $0, %eax
- testl $0x8000, (%ecx)
- jz kraj
- incl %eax
- kraj:
- movl %ebp, %esp
- popl %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement