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
omega-mv / tools / exp445 / arms / examples / power_mod / program.omegese
| 1 | fn mod a ulong b ulong m ulong to ulong |
| 2 | ret rem mul a b m |
| 3 | end |
| 4 | fn power_mod b uint e uint m uint to uint |
| 5 | mm = ulong m |
| 6 | r = rem ulong 1 mm |
| 7 | x = rem ulong b mm |
| 8 | while gt e 0 bound 40 |
| 9 | if eq rem e 2 1 |
| 10 | r = mod r x mm |
| 11 | end |
| 12 | x = mod x x mm |
| 13 | e = div e 2 |
| 14 | end |
| 15 | ret uint r |
| 16 | end |