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 / bench / omc_efficiency / kernels / om2 / leafcall.om

36 lines · 863 bytes Raw Blame History
1note leafcall: a two-parameter leaf function called 30000000 times from a loop that keeps values
2note live across the call; s = 1 + sum mix(i, 2654435761), t = xor of every running s. Prints s then t.
3note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without
4note start-up and output) as one decimal line on stderr; stdout is unchanged.
5om2
6global obuf uchar 32
7fn putnum fd int v ulong to void
8put obuf 31 10
9p = ulong 31
10x = v
11while gt x 9
12p = sub p 1
13put obuf p uchar add rem x 10 48
14x = div x 10
15end
16p = sub p 1
17put obuf p uchar add x 48
18w = write fd obuf p sub 32 p
19end
20fn mix x ulong k ulong to ulong
21ret xor mul x k shr x 5
22end
23fn main to int
24t0 = monons
25s = ulong 1
26t = ulong 0
27for i ulong 30000000
28s = add s mix i 2654435761
29t = xor t s
30end
31t1 = monons
32putnum 2 ulong sub t1 t0
33putnum 1 s
34putnum 1 t
35ret 0
36end