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
omega-mv / seed / qualification / om2 / sec / s5s7 / l5-endian.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note contract 5 layout line 158: fields at declared width and endianness; a big-endian field is |
| 3 | note stored most significant byte first, a little-endian one least significant first, and get reads |
| 4 | note 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). |
| 5 | om2 |
| 6 | layout be16 16 |
| 7 | field fa uint 1 at 0 big |
| 8 | field fb ulong 1 at 4 big |
| 9 | field fc ushort 2 at 12 little |
| 10 | end |
| 11 | fn fill x edit be16 to void |
| 12 | put x fa 0 0x0a0b0c0d |
| 13 | put x fb 0 0x0102030405060708 |
| 14 | put x fc 0 0xbeef |
| 15 | put x fc 1 0x1234 |
| 16 | end |
| 17 | fn show x view be16 to void |
| 18 | puth ulong get x fa 0 |
| 19 | puth get x fb 0 |
| 20 | puth ulong get x fc 0 |
| 21 | puth ulong get x fc 1 |
| 22 | end |
| 23 | fn main to int |
| 24 | c = new uchar 16 0 |
| 25 | fill c |
| 26 | w = write 1 c 0 16 |
| 27 | show c |
| 28 | ret 0 |
| 29 | end |