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 / freest-fixtures / scalar.om

23 lines · 469 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Arbitrary names, constants, nested calls, branch locals, signed comparisons and wrap.
3const STEP ulong 1
4fn upper x uint to ulong
5ret ulong add x uint 1
6end
7fn choose x long to long
8if lt x long 0
9ret long -1
10else
11ret long 1
12end
13end
14fn portable_scalar value uint signedv long to ulong
15v = upper value
16if lt choose signedv long 0
17narrow = uchar 7
18v = add v ulong narrow
19else
20v = add v STEP
21end
22ret v
23end