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 / seed / semhash / cases / inv_notes.om

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