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 / seed / semhash / cases / ren_fn.om
| 1 | om2 |
| 2 | note semhash fixture: the base unit every case is diffed against |
| 3 | const lim ulong 7 |
| 4 | global buf uchar 16 |
| 5 | struct pt px uint py uint end |
| 6 | layout lay 8 |
| 7 | field fa uchar at 0 little |
| 8 | field fb ushort at 1 little |
| 9 | end |
| 10 | fn leaf a ulong b ulong to ulong |
| 11 | ret add a b |
| 12 | end |
| 13 | fn mid x ulong to ulong |
| 14 | y = leaf x 3 |
| 15 | ret mul y 2 |
| 16 | end |
| 17 | fn top n ulong to ulong |
| 18 | r = mid n |
| 19 | ret add r 1 |
| 20 | end |
| 21 | fn other2 s ulong to ulong |
| 22 | ret xor s 5 |
| 23 | end |
| 24 | fn psub a ulong b ulong to ulong |
| 25 | ret sub a b |
| 26 | end |
| 27 | fn useconst v ulong to ulong |
| 28 | ret add v lim |
| 29 | end |
| 30 | fn useglob i ulong to ulong |
| 31 | put buf 0 uchar i |
| 32 | ret len buf |
| 33 | end |
| 34 | fn callargs u ulong to ulong |
| 35 | ret psub u 2 |
| 36 | end |
| 37 | fn rdlay c view lay i ulong to ulong |
| 38 | ret ulong get c i |
| 39 | end |
| 40 | fn sumpt p view pt to ulong |
| 41 | q = ulong get p px |
| 42 | ret add q ulong get p py |
| 43 | end |
| 44 | fn iseven n ulong to bool |
| 45 | if eq n 0 |
| 46 | ret true |
| 47 | end |
| 48 | ret isodd sub n 1 |
| 49 | end |
| 50 | fn isodd n ulong to bool |
| 51 | if eq n 0 |
| 52 | ret false |
| 53 | end |
| 54 | ret iseven sub n 1 |
| 55 | end |
| 56 | fn main to int |
| 57 | c = new uchar 8 0 |
| 58 | put c 1 9 |
| 59 | p = new pt 3 4 |
| 60 | t = add top 1 other2 2 |
| 61 | t = add t psub 9 4 |
| 62 | t = add t useconst 1 |
| 63 | t = add t useglob 2 |
| 64 | t = add t callargs 5 |
| 65 | t = add t rdlay c 1 |
| 66 | t = add t sumpt p |
| 67 | if iseven t |
| 68 | t = add t 64 |
| 69 | end |
| 70 | ret int rem t 251 |
| 71 | end |