interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / nvidia / om / scan / scan_check.om

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