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 / qualification / om2 / sec / s5s7 / abi / abiv.om

54 lines · 1105 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note ABI v2 test unit for oracle/s5s7/abi/driver.c (contract 6 lines 180-203, errata E1, E3).
3note Function mode, OM-2, exports only. bcnt and vcnt never read an element, so a mutant bridge that
4note skips a status-32 check returns status 0 with result = len instead of touching memory (clean kill).
5om2
6layout pair 16
7field lo ulong at 0 little
8field hi ulong at 8 big
9end
10export fn vsum v view ulong * to ulong
11x = ulong 0
12for i ulong len v
13x = add x get v i
14end
15ret x
16end
17export fn bcnt b view uchar * to ulong
18ret len b
19end
20export fn vcnt v view ulong * to ulong
21ret len v
22end
23export fn ecpy d edit uchar * s view uchar * to ulong
24n = len d
25if lt len s n
26n = len s
27end
28for i ulong n
29put d i get s i
30end
31ret n
32end
33export fn rev s view uchar * r out uchar 4 to void
34for i ulong 4
35put r i get s sub 3 i
36end
37end
38export fn revtrap s view uchar * r out uchar 4 to void
39for i ulong 4
40put r i get s i
41end
42trap 9
43end
44export fn lay p edit pair v ulong to void
45put p lo v
46put p hi v
47end
48export fn spin n ulong to ulong
49x = ulong 0
50for i ulong n
51x = add x i
52end
53ret x
54end