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

35 lines · 854 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.
5global out uchar 32
6fn putnum fd int v ulong to void
7put out 31 10
8p = ulong 31
9x = v
10while gt x 9
11p = sub p 1
12put out p uchar add rem x 10 48
13x = div x 10
14end
15p = sub p 1
16put out p uchar add x 48
17w = write fd out p sub 32 p
18end
19fn mix x ulong k ulong to ulong
20ret xor mul x k shr x 5
21end
22fn main to int
23t0 = monons
24s = ulong 1
25t = ulong 0
26for i ulong 30000000
27s = add s mix i 2654435761
28t = xor t s
29end
30t1 = monons
31putnum 2 ulong sub t1 t0
32putnum 1 s
33putnum 1 t
34ret 0
35end