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 / neg_const.om

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