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_reorder.om

71 lines · 1135 bytes Raw Blame History
1om2
2note 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
10fn main to int
11c = new uchar 8 0
12put c 1 9
13p = new pt 3 4
14t = add top 1 other 2
15t = add t psub 9 4
16t = add t useconst 1
17t = add t useglob 2
18t = add t callargs 5
19t = add t rdlay c 1
20t = add t sumpt p
21if iseven t
22t = add t 64
23end
24ret int rem t 251
25end
26fn isodd n ulong to bool
27if eq n 0
28ret false
29end
30ret iseven sub n 1
31end
32fn sumpt p view pt to ulong
33q = ulong get p px
34ret add q ulong get p py
35end
36fn leaf a ulong b ulong to ulong
37ret add a b
38end
39fn top n ulong to ulong
40r = mid n
41ret add r 1
42end
43fn mid x ulong to ulong
44y = leaf x 3
45ret mul y 2
46end
47fn iseven n ulong to bool
48if eq n 0
49ret true
50end
51ret isodd sub n 1
52end
53fn other s ulong to ulong
54ret xor s 5
55end
56fn rdlay c view lay i ulong to ulong
57ret ulong get c i
58end
59fn psub a ulong b ulong to ulong
60ret sub a b
61end
62fn callargs u ulong to ulong
63ret psub u 2
64end
65fn useglob i ulong to ulong
66put buf 0 uchar i
67ret len buf
68end
69fn useconst v ulong to ulong
70ret add v lim
71end