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 / gpu / nvidia / om / scan / scan_check.om
| 1 | om2 |
| 2 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | note op 0 poison count; op 1 modular prefix differences; op 2 sorted adjacent keys. |
| 4 | fn sc_part w view uint * x view uint * q edit ulong 4 to ulong |
| 5 | for z ulong get q 2 |
| 6 | i = add get q 1 z |
| 7 | if eq get q 0 0 |
| 8 | if eq get w i 2141195181 |
| 9 | put q 3 add get q 3 1 |
| 10 | end |
| 11 | else |
| 12 | if eq get q 0 1 |
| 13 | v = get w i |
| 14 | if gt i 0 |
| 15 | v = sub v get w sub i 1 |
| 16 | end |
| 17 | if ne v get x i |
| 18 | put q 3 add get q 3 1 |
| 19 | end |
| 20 | else |
| 21 | if gt i 0 |
| 22 | if lt get w i get w sub i 1 |
| 23 | put q 3 add get q 3 1 |
| 24 | end |
| 25 | end |
| 26 | end |
| 27 | end |
| 28 | end |
| 29 | ret 0 |
| 30 | end |
| 31 | fn sc_check w view uint * x view uint * op uint to ulong |
| 32 | q = new ulong 4 0 |
| 33 | put q 0 ulong op |
| 34 | for blk ulong add div len w 1000000 1 |
| 35 | put q 1 mul blk 1000000 |
| 36 | put q 2 sub len w get q 1 |
| 37 | if gt get q 2 1000000 |
| 38 | put q 2 1000000 |
| 39 | end |
| 40 | rc = sc_part w x q |
| 41 | if ne rc 0 |
| 42 | ret rc |
| 43 | end |
| 44 | end |
| 45 | ret get q 3 |
| 46 | end |