interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tools / exp445 / arms / examples / power_mod / program.omegese

16 lines · 258 bytes Raw Blame History
1fn mod a ulong b ulong m ulong to ulong
2ret rem mul a b m
3end
4fn power_mod b uint e uint m uint to uint
5mm = ulong m
6r = rem ulong 1 mm
7x = rem ulong b mm
8while gt e 0 bound 40
9if eq rem e 2 1
10r = mod r x mm
11end
12x = mod x x mm
13e = div e 2
14end
15ret uint r
16end