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 / ng / front / cases / sh_mix_width.om
| 1 | note sh_mix_width: a uint value shifted by a ulong amount: 31 (the width - 1) is fine, 32 (the width) traps 7 |
| 2 | note (exit 107). "w\n" comes first; exit 1 would mean the shift by 31 gave a wrong value. |
| 3 | text t "w\n" |
| 4 | fn shu a uint s ulong to uint |
| 5 | ret shl a s |
| 6 | end |
| 7 | fn main to int |
| 8 | w = write 1 t 0 2 |
| 9 | x = shu 1 31 |
| 10 | if ne x 2147483648 |
| 11 | ret 1 |
| 12 | end |
| 13 | y = shu 1 32 |
| 14 | ret int and y 255 |
| 15 | end |