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 / aienux / kernel / x86 / tools / arithmetic.om

31 lines · 476 bytes Raw Blame History
1target x86linux
2note Local ABI: signed operation 1 add, 2 subtract, 3 multiply, 4 divide.
3note Checked arithmetic traps retain the compiler's overflow and zero semantics.
4fn run args view long 512 out edit long 512 count ulong to ulong
5if ne count 24
6trap 3
7end
8op = get args 0
9a = get args 1
10b = get args 2
11v = long 0
12if eq op 1
13v = add a b
14else
15if eq op 2
16v = sub a b
17else
18if eq op 3
19v = mul a b
20else
21if eq op 4
22v = div a b
23else
24trap 3
25end
26end
27end
28end
29put out 0 v
30ret 8
31end