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 / seed / qualification / om2 / sec / s5s7 / l5-endian.om

29 lines · 827 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note contract 5 layout line 158: fields at declared width and endianness; a big-endian field is
3note stored most significant byte first, a little-endian one least significant first, and get reads
4note the value back. Erratum E5: fa and fb have COUNT 1, so they are arrays and take index 0. stdout: the 16 bytes, then the four values in hex (exp/l5-endian.out, python3).
5om2
6layout be16 16
7field fa uint 1 at 0 big
8field fb ulong 1 at 4 big
9field fc ushort 2 at 12 little
10end
11fn fill x edit be16 to void
12put x fa 0 0x0a0b0c0d
13put x fb 0 0x0102030405060708
14put x fc 0 0xbeef
15put x fc 1 0x1234
16end
17fn show x view be16 to void
18puth ulong get x fa 0
19puth get x fb 0
20puth ulong get x fc 0
21puth ulong get x fc 1
22end
23fn main to int
24c = new uchar 16 0
25fill c
26w = write 1 c 0 16
27show c
28ret 0
29end