curly/code/gcd.txt

40 lines
166 B
Plaintext

>main
gto
:gcd
=v
=u
$u
$v
>gcd-loop
gge
$u
=t
$v
=u
$t
=v
:gcd-loop
$v
0
>gcd-ret
gle
$v
=t
$u
$v
mod
=v
$t
=u
>gcd-loop
gto
:gcd-ret
$u
ret
:main
4
16
>gcd
fun
end