Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #setparity program
- .section .data
- .section .text
- .globl SetParity
- #int SetParity(unsigned short int* v);
- SetParity:
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- pushl %esi
- movl 8(%ebp), %esi
- andl $0x7fffffff, (%esi)
- movl (%esi), %edx
- pocetak:
- movl $0, %eax
- movb $0, %cl #broj jedinica
- petlja:
- shll $1, %edx
- adcb $0, %cl
- adcl $0, %eax
- cmpl $0, %edx
- jne petlja
- broj:
- movl (%esi), %edx
- shrl (%ebx)
- jc neparan
- paran:
- andl $0x7fffffff, (%esi) #postavljanje bita pariteta na 0
- roll %cl, (%esi)
- neparan:
- orl $0x80000000, (%esi)
- rorl %cl, (%esi)
- kraj:
- popl %esi
- popl %ebx
- movl %ebp, %esp
- popl %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement