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 / tests / checker2 / lrat / p02_avg_u8.osc
| 1 | // prove: avg |
| 2 | // expect: holds |
| 3 | // overflow-free average of two bytes; never below their common bits. |
| 4 | fn avg(a: u8, b: u8) -> u8 ensures result >= (a & b) { |
| 5 | return (a & b) + ((a ^ b) >> 1); |
| 6 | } |