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/examples/om2-tour.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 / examples / om2-tour.om` 61 lines ยท 1139 bytes Raw Blame History 1 note OM-2 profile tour: hex, rotr, unroll, fresh, layout, unsized views, part, abstract dup32 2 om2 3 layout blk 8 4 field lo uint at 0 little 5 field hi uint at 4 little 6 end 7 abstract v32 ulong 8 holds v32 dup32 9 note the erasing constructor: the body must be exactly this line 10 fn v32mk x uint to v32 11 ret seal v32 or shl ulong x 32 ulong x 12 end 13 fn seed s edit uint 8 fresh to uint 14 for i uint 8 unroll 15 put s i add i 0x9e3779b9 16 end 17 ret get s 7 18 end 19 fn stamp c edit blk to uint 20 put c lo 0x01020304 21 put c hi 0x05060708 22 ret or get c lo shl get c hi 16 23 end 24 note a layout field name is read through a layout parameter, not a plain uchar array 25 fn rd c view blk to uint 26 ret get c lo 27 end 28 fn fold a view uint * to uint 29 x = new uint 1 0 30 put x 0 uint len a 31 for i uint uint len a 32 put x 0 add get x 0 rotr get a i 5 33 end 34 ret get x 0 35 end 36 fn main to int 37 s = new uint 8 0 38 v = seed s 39 a = new uint 4 0 40 put a 0 v 41 put a 1 rotr v 12 42 put a 2 0xffffffff 43 put a 3 add v 1 44 t = fold part a 1 2 45 c = new uchar 8 0 46 w = stamp c 47 u = open v32mk 7 48 if ne u or shl ulong 7 32 ulong 7 49 ret 9 50 end 51 if eq t 0 52 ret 10 53 end 54 if ne rd c 0x01020304 55 ret 11 56 end 57 if ne shr w 16 0x070a 58 ret 12 59 end 60 ret 0 61 end