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/seed/ng/front/runs/arith-s.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 / seed / ng / front / runs / arith-s.om` 34 lines ยท 880 bytes Raw Blame History 1 note arith-s: kernels/arith.om with i = 0 .. `1999999` (was `39999999`), for ngrun in gate-front-ir. arith: 2 note wrapping multiply-add hash h = h*31 + i and s = sum of ((i*i) xor (i >> 3)) rem `1000003`, 3 note all ulong (unsigned wraps modulo 2^64). Prints h then s. 4 note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without 5 note start-up and output) as one decimal line on stderr; stdout is unchanged. 6 global out uchar 32 7 fn putnum fd int v ulong to void 8 put out 31 10 9 p = ulong 31 10 x = v 11 while gt x 9 12 p = sub p 1 13 put out p uchar add rem x 10 48 14 x = div x 10 15 end 16 p = sub p 1 17 put out p uchar add x 48 18 w = write fd out 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 `2000000` 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