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/seed/ng/front/cases/sh_mix.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 / seed / ng / front / cases / sh_mix.om` 54 lines ยท 1286 bytes Raw Blame History 1 note sh_mix: shl and shr whose value and amount have different integer types. omc admits them (omc.om 2 note rdval: only a shift may mix its operand types) and checks the amount against the value's width 3 note (bo_schk, trap 7). The operands are parameters, so nothing folds. Ten results, 8 bytes each, 4 note little-endian (signed ones bitcast from long); exit 0. Expected bytes: groups4.expect. 5 global o uchar 80 6 fn put8 p ulong v ulong to void 7 for j ulong 8 8 put o add p j uchar and shr v mul j 8 255 9 end 10 end 11 fn mx1 a ulong s uchar to ulong 12 ret shl a s 13 end 14 fn mx2 a uint s ulong to uint 15 ret shr a s 16 end 17 fn mx3 a byte s long to byte 18 ret shr a s 19 end 20 fn mx4 a short s uchar to short 21 ret shr a s 22 end 23 fn mx5 a long s ushort to long 24 ret shl a s 25 end 26 fn mx6 a uchar s long to uchar 27 ret shl a s 28 end 29 fn mx7 a ushort s int to ushort 30 ret shr a s 31 end 32 fn mx8 a int s ulong to int 33 ret shl a s 34 end 35 fn mx9 a uint s byte to uint 36 ret shl a s 37 end 38 fn mx10 a ulong s uchar to ulong 39 ret shl a s 40 end 41 fn main to int 42 put8 0 mx1 1 40 43 put8 8 ulong mx2 `4026531840` 28 44 put8 16 bitcast ulong long mx3 -128 7 45 put8 24 bitcast ulong long mx4 -32768 15 46 put8 32 bitcast ulong mx5 3 61 47 put8 40 ulong mx6 1 7 48 put8 48 ulong mx7 65535 15 49 put8 56 ulong mx8 1 30 50 put8 64 ulong mx9 5 3 51 put8 72 mx10 1 63 52 w = write 1 o 0 80 53 ret 0 54 end