interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / tests / native / hsum.om

20 lines · 402 bytes Raw Blame History
1note hsum: a unit with private helpers. The compiler enters a function-mode unit at its last function
2note (word 0 branches there), so only that function is bound; sq and cap are internal calls.
3fn sq x ulong to ulong
4ret mul x x
5end
6
7fn cap x ulong to ulong
8if gt x 1000000
9trap 9
10end
11ret x
12end
13
14fn hsum a view uchar 4 b ulong to ulong
15s = b
16for i ulong 4
17s = add s sq ulong get a i
18end
19ret cap s
20end