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/tests/compiler/slices/zz_narrow_idx.osc # 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 / tests / compiler / slices / zz_narrow_idx.osc` 20 lines ยท 1005 bytes Raw Blame History 1 // slice-entry: w8 w32 w64 neg mul shl 2 // Narrow and wrapping index arithmetic: unsigned types wrap modulo 2^w, so w8(i) reads b[(i+255) mod 256]. 3 // slice-run: w8 bytes:aabb 1 -> 170 4 // slice-run: w8 bytes:aabb 0 -> trap=BOUNDS 5 // slice-run: w32 bytes:aabb 1 -> 170 6 // slice-run: w32 bytes:aabb 0 -> trap=BOUNDS 7 // slice-run: w64 bytes:aabb 1 -> 170 8 // slice-run: w64 bytes:aabb 0 -> trap=BOUNDS 9 // slice-run: neg bytes:aabb 1 -> 170 10 // slice-run: neg bytes:aabb 0 -> trap=BOUNDS 11 // slice-run: mul bytes:aabbccdd 1 -> 204 12 // slice-run: mul bytes:aabbccdd 2 -> trap=BOUNDS 13 // slice-run: shl bytes:aabb 0 -> 170 14 // slice-run: shl bytes:aabb 1 -> trap=BOUNDS 15 fn w8(b: bytes, i: u8) -> u64 { return b[i + 255]; } 16 fn w32(b: bytes, i: u32) -> u64 { return b[i + `4294967295`]; } 17 fn w64(b: bytes, i: u64) -> u64 { return b[i + `18446744073709551615`]; } 18 fn neg(b: bytes, i: i32) -> u64 { return b[i - 1]; } 19 fn mul(b: bytes, i: u64) -> u64 { return b[i * 2]; } 20 fn shl(b: bytes, i: u64) -> u64 { return b[i << 63]; }