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 / om / runtime / rx_skillroute_core.om
| 1 | om2 |
| 2 | note rx_skillroute_core.om -- Skill Router rejection-class bitmask and |
| 3 | note digest-zero check in pure OM-2. |
| 4 | note Replaces why_of and digest_zero in src/runtime/rx_skillroute.c. |
| 5 | |
| 6 | export fn rx_sr_digest_zero d view uchar 32 to ulong |
| 7 | acc = uchar 0 |
| 8 | for i ulong 32 |
| 9 | acc = or acc get d i |
| 10 | end |
| 11 | if eq acc 0 |
| 12 | ret 1 |
| 13 | end |
| 14 | ret 0 |
| 15 | end |
| 16 | |
| 17 | note counts[10]: |
| 18 | note 0 rejected_dead -> 0x001 |
| 19 | note 1 rejected_unavailable -> 0x002 |
| 20 | note 2 rejected_authority -> 0x004 |
| 21 | note 3 not_a_skill -> 0x008 |
| 22 | note 4 not_executable -> 0x010 |
| 23 | note 5 digest_mismatch -> 0x020 |
| 24 | note 6 remote_refused -> 0x040 |
| 25 | note 7 pin_mismatch -> 0x080 |
| 26 | note 8 machine_mismatch -> 0x100 |
| 27 | note 9 machine_unknown -> 0x200 |
| 28 | export fn rx_sr_why_of counts view ulong 10 to ulong |
| 29 | w = ulong 0 |
| 30 | for i ulong 10 |
| 31 | if ne get counts i 0 |
| 32 | w = or w shl ulong 1 i |
| 33 | end |
| 34 | end |
| 35 | ret w |
| 36 | end |