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 / equiv / hexv.unit.om
| 1 | note irequiv fixture (issue 826): hex digit value, a real duplicate pair. |
| 2 | note js_hexv (seed/json/json.om line 582) and hhexv (seed/net/http.om line 332) |
| 3 | note are identical at omega-mv 62d1d0d6. Their ret ulong sub c K lines are each |
| 4 | note split into d = sub c K / ret ulong d here, because omc IR mode at that |
| 5 | note revision refuses a conversion of a computed operand (error 7, ir_cast). |
| 6 | note hexfold is a refactor: one letter range after or c 32 folds case. |
| 7 | note hexoff1 is a deliberate mutant (le c 70 became lt c 70): it differs |
| 8 | note from the others at exactly one input, c = 70 ('F'). |
| 9 | fn js_hexv c uchar to ulong |
| 10 | if and ge c 48 le c 57 |
| 11 | d = sub c 48 |
| 12 | ret ulong d |
| 13 | end |
| 14 | if and ge c 97 le c 102 |
| 15 | d = sub c 87 |
| 16 | ret ulong d |
| 17 | end |
| 18 | if and ge c 65 le c 70 |
| 19 | d = sub c 55 |
| 20 | ret ulong d |
| 21 | end |
| 22 | ret 16 |
| 23 | end |
| 24 | fn hhexv c uchar to ulong |
| 25 | if and ge c 48 le c 57 |
| 26 | d = sub c 48 |
| 27 | ret ulong d |
| 28 | end |
| 29 | if and ge c 97 le c 102 |
| 30 | d = sub c 87 |
| 31 | ret ulong d |
| 32 | end |
| 33 | if and ge c 65 le c 70 |
| 34 | d = sub c 55 |
| 35 | ret ulong d |
| 36 | end |
| 37 | ret 16 |
| 38 | end |
| 39 | fn hexfold c uchar to ulong |
| 40 | if and ge c 48 le c 57 |
| 41 | d = sub c 48 |
| 42 | ret ulong d |
| 43 | end |
| 44 | l = or c 32 |
| 45 | if and ge l 97 le l 102 |
| 46 | d = sub l 87 |
| 47 | ret ulong d |
| 48 | end |
| 49 | ret 16 |
| 50 | end |
| 51 | fn hexoff1 c uchar to ulong |
| 52 | if and ge c 48 le c 57 |
| 53 | d = sub c 48 |
| 54 | ret ulong d |
| 55 | end |
| 56 | if and ge c 97 le c 102 |
| 57 | d = sub c 87 |
| 58 | ret ulong d |
| 59 | end |
| 60 | if and ge c 65 lt c 70 |
| 61 | d = sub c 55 |
| 62 | ret ulong d |
| 63 | end |
| 64 | ret 16 |
| 65 | end |