Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/bench/omc_efficiency/kernels/om2/arith.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / bench / omc_efficiency / kernels / om2 / arith.om` 34 lines ยท 812 bytes Raw Blame History 1 note arith: wrapping multiply-add hash h = h*31 + i and s = sum of ((i*i) xor (i >> 3)) rem `1000003`, 2 note i = 0 .. `39999999`, all ulong (unsigned wraps modulo 2^64). Prints h then s. 3 note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without 4 note start-up and output) as one decimal line on stderr; stdout is unchanged. 5 om2 6 global obuf uchar 32 7 fn putnum fd int v ulong to void 8 put obuf 31 10 9 p = ulong 31 10 x = v 11 while gt x 9 12 p = sub p 1 13 put obuf p uchar add rem x 10 48 14 x = div x 10 15 end 16 p = sub p 1 17 put obuf p uchar add x 48 18 w = write fd obuf p sub 32 p 19 end 20 fn main to int 21 t0 = monons 22 h = ulong 0 23 s = ulong 0 24 for i ulong `40000000` 25 h = add mul h 31 i 26 t = xor mul i i shr i 3 27 s = add s rem t `1000003` 28 end 29 t1 = monons 30 putnum 2 ulong sub t1 t0 31 putnum 1 h 32 putnum 1 s 33 ret 0 34 end