Greatest common divisor: Difference between revisions

Add 8086 assembly implementation, using AT & T syntax under linux
(Add 8086 assembly implementation, using AT & T syntax under linux)
Line 1:
{{task|Arithmetic operations}}[[Category:Recursion]]
This task requires the finding of the greatest common divisor of two integers.
=={{header|8086 Assembly}}==
Using '''AT & T''' syntax under '''linux'''.
<lang 8086 Assembly>
.text
.global pgcd
 
pgcd:
push %ebp
mov %esp, %ebp
 
mov 8(%ebp), %eax
mov 12(%ebp), %ecx
push %edx
 
.loop:
cmp $0, %ecx
je .end
xor %edx, %edx
div %ecx
mov %ecx, %eax
mov %edx, %ecx
jmp .loop
 
.end:
pop %edx
leave
ret
</lang>
=={{header|ActionScript}}==
<lang ActionScript>//Euclidean algorithm
Anonymous user