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 / inv_notes.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 | |
| 11 | note reformatted: fn leaf a ulong b ulong to ulong |
| 12 | fn leaf a ulong b ulong to ulong |
| 13 | ret add a b |
| 14 | end |
| 15 | |
| 16 | note reformatted: fn mid x ulong to ulong |
| 17 | fn mid x ulong to ulong |
| 18 | y = leaf x 3 |
| 19 | ret mul y 2 |
| 20 | end |
| 21 | |
| 22 | note reformatted: fn top n ulong to ulong |
| 23 | fn top n ulong to ulong |
| 24 | r = mid n |
| 25 | ret add r 1 |
| 26 | end |
| 27 | |
| 28 | note reformatted: fn other s ulong to ulong |
| 29 | fn other s ulong to ulong |
| 30 | ret xor s 5 |
| 31 | end |
| 32 | |
| 33 | note reformatted: fn psub a ulong b ulong to ulong |
| 34 | fn psub a ulong b ulong to ulong |
| 35 | ret sub a b |
| 36 | end |
| 37 | |
| 38 | note reformatted: fn useconst v ulong to ulong |
| 39 | fn useconst v ulong to ulong |
| 40 | ret add v lim |
| 41 | end |
| 42 | |
| 43 | note reformatted: fn useglob i ulong to ulong |
| 44 | fn useglob i ulong to ulong |
| 45 | put buf 0 uchar i |
| 46 | ret len buf |
| 47 | end |
| 48 | |
| 49 | note reformatted: fn callargs u ulong to ulong |
| 50 | fn callargs u ulong to ulong |
| 51 | ret psub u 2 |
| 52 | end |
| 53 | |
| 54 | note reformatted: fn rdlay c view lay i ulong to ulong |
| 55 | fn rdlay c view lay i ulong to ulong |
| 56 | ret ulong get c i |
| 57 | end |
| 58 | |
| 59 | note reformatted: fn sumpt p view pt to ulong |
| 60 | fn sumpt p view pt to ulong |
| 61 | q = ulong get p px |
| 62 | ret add q ulong get p py |
| 63 | end |
| 64 | |
| 65 | note reformatted: fn iseven n ulong to bool |
| 66 | fn iseven n ulong to bool |
| 67 | if eq n 0 |
| 68 | ret true |
| 69 | end |
| 70 | ret isodd sub n 1 |
| 71 | end |
| 72 | |
| 73 | note reformatted: fn isodd n ulong to bool |
| 74 | fn isodd n ulong to bool |
| 75 | if eq n 0 |
| 76 | ret false |
| 77 | end |
| 78 | ret iseven sub n 1 |
| 79 | end |
| 80 | |
| 81 | note reformatted: fn main to int |
| 82 | fn main to int |
| 83 | c = new uchar 8 0 |
| 84 | put c 1 9 |
| 85 | p = new pt 3 4 |
| 86 | t = add top 1 other 2 |
| 87 | t = add t psub 9 4 |
| 88 | t = add t useconst 1 |
| 89 | t = add t useglob 2 |
| 90 | t = add t callargs 5 |
| 91 | t = add t rdlay c 1 |
| 92 | t = add t sumpt p |
| 93 | if iseven t |
| 94 | t = add t 64 |
| 95 | end |
| 96 | ret int rem t 251 |
| 97 | end |