Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/runtime/rx_semantic_om2.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / runtime / rx_semantic_om2.om` 41 lines ยท 1120 bytes Raw Blame History 1 om2 2 note SPDX-License-Identifier: AGPL-3.0-only 3 note Pure seeded OM-2 semantic incremental primitives backing src/runtime/rx_semantic.c: 4 note constant-time digest equality, 56-bit derived node ID packing, and input uniqueness check. 5 6 note Constant-time 32-byte digest comparison. Returns 1 if equal, 0 otherwise. 7 export fn rx_sem_digest_eq_om2 a view uchar 32 b view uchar 32 to ulong 8 diff = ulong 0 9 for i ulong 32 10 diff = or diff xor ulong get a i ulong get b i 11 end 12 if eq diff 0 13 ret 1 14 end 15 ret 0 16 end 17 18 note Pack (kind << 56) | le56(d[0..6]) into a 64-bit semantic node ID. 19 export fn rx_sem_node_id_from_hash d view uchar 32 kind ulong to ulong 20 v = ulong 0 21 for i ulong 7 22 b = ulong get d i 23 v = or v shl b mul i 8 24 end 25 ret or shl kind 56 v 26 end 27 28 note Verify no duplicate input semantic IDs in inputs[0..n-1]. Returns 1 if unique, 0 else. 29 export fn rx_sem_inputs_unique inputs view ulong * n ulong to ulong 30 for i ulong n bound 64 31 vi = get inputs i 32 j = add i 1 33 while lt j n bound 64 34 if eq vi get inputs j 35 ret 0 36 end 37 j = add j 1 38 end 39 end 40 ret 1 41 end