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/qualification/om2/sec/s3s4/rot-values-om1.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 / qualification / om2 / sec / s3s4 / rot-values-om1.om` 167 lines ยท 3080 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note OM-1 twin of rot-values.om (contract section 3 lines 76-83), for the pinned compiler `734f0a39`: 3 note the same computation with rotations written as OM-1 shifts (tr*/tl* below: n = 0 returns x, else 4 note or shr x n shl x w-n; OMEGESE 9.3: unsigned shl wraps modulo 2^w, shift amounts 0..w-1). 5 note Same expected stdout as the OM-2 unit: oracle/s3s4/exp/rot-values.out. This cross-checks the 6 note python oracle against OM-1 arithmetic now, independent of any OM-2 compiler. 7 note (this line replaces the om2 line, so the line numbers equal those of rot-values.om) 8 note OM-1 unit 9 fn rr8 x uchar n uchar to uchar 10 ret tr8 x n 11 end 12 fn rl8 x uchar n uchar to uchar 13 ret tl8 x n 14 end 15 fn rr16 x ushort n ushort to ushort 16 ret tr16 x n 17 end 18 fn rl16 x ushort n ushort to ushort 19 ret tl16 x n 20 end 21 fn rr32 x uint n uint to uint 22 ret tr32 x n 23 end 24 fn rl32 x uint n uint to uint 25 ret tl32 x n 26 end 27 fn rr64 x ulong n ulong to ulong 28 ret tr64 x n 29 end 30 fn rl64 x ulong n ulong to ulong 31 ret tl64 x n 32 end 33 fn main to int 34 a = uchar 177 35 pu ulong tr8 a 0 36 pu ulong tr8 a 1 37 pu ulong tr8 a 3 38 pu ulong tr8 a 7 39 pu ulong tl8 a 0 40 pu ulong tl8 a 1 41 pu ulong tl8 a 3 42 pu ulong tl8 a 7 43 pu ulong rr8 a 0 44 pu ulong rr8 a 1 45 pu ulong rr8 a 3 46 pu ulong rr8 a 7 47 pu ulong rl8 a 0 48 pu ulong rl8 a 1 49 pu ulong rl8 a 3 50 pu ulong rl8 a 7 51 for n uchar 8 52 pu ulong rr8 a n 53 pu ulong rl8 a n 54 end 55 b = ushort 45508 56 pu ulong tr16 b 0 57 pu ulong tr16 b 1 58 pu ulong tr16 b 5 59 pu ulong tr16 b 15 60 pu ulong tl16 b 0 61 pu ulong tl16 b 1 62 pu ulong tl16 b 5 63 pu ulong tl16 b 15 64 pu ulong rr16 b 0 65 pu ulong rr16 b 1 66 pu ulong rr16 b 5 67 pu ulong rr16 b 15 68 pu ulong rl16 b 0 69 pu ulong rl16 b 1 70 pu ulong rl16 b 5 71 pu ulong rl16 b 15 72 for n ushort 16 73 pu ulong rr16 b n 74 pu ulong rl16 b n 75 end 76 c = uint `4041331395` 77 pu ulong tr32 c 0 78 pu ulong tr32 c 1 79 pu ulong tr32 c 13 80 pu ulong tr32 c 31 81 pu ulong tl32 c 0 82 pu ulong tl32 c 1 83 pu ulong tl32 c 13 84 pu ulong tl32 c 31 85 pu ulong rr32 c 0 86 pu ulong rr32 c 1 87 pu ulong rr32 c 13 88 pu ulong rr32 c 31 89 pu ulong rl32 c 0 90 pu ulong rl32 c 1 91 pu ulong rl32 c 13 92 pu ulong rl32 c 31 93 for n uint 32 94 pu ulong rr32 c n 95 pu ulong rl32 c n 96 end 97 d = ulong `9305357566071262703` 98 pu tr64 d 0 99 pu tr64 d 1 100 pu tr64 d 29 101 pu tr64 d 63 102 pu tl64 d 0 103 pu tl64 d 1 104 pu tl64 d 29 105 pu tl64 d 63 106 pu rr64 d 0 107 pu rr64 d 1 108 pu rr64 d 29 109 pu rr64 d 63 110 pu rl64 d 0 111 pu rl64 d 1 112 pu rl64 d 29 113 pu rl64 d 63 114 for n ulong 64 115 pu rr64 d n 116 pu rl64 d n 117 end 118 ret 0 119 end 120 fn tr8 x uchar n uchar to uchar 121 if eq n 0 122 ret x 123 end 124 ret or shr x n shl x sub 8 n 125 end 126 fn tl8 x uchar n uchar to uchar 127 if eq n 0 128 ret x 129 end 130 ret or shl x n shr x sub 8 n 131 end 132 fn tr16 x ushort n ushort to ushort 133 if eq n 0 134 ret x 135 end 136 ret or shr x n shl x sub 16 n 137 end 138 fn tl16 x ushort n ushort to ushort 139 if eq n 0 140 ret x 141 end 142 ret or shl x n shr x sub 16 n 143 end 144 fn tr32 x uint n uint to uint 145 if eq n 0 146 ret x 147 end 148 ret or shr x n shl x sub 32 n 149 end 150 fn tl32 x uint n uint to uint 151 if eq n 0 152 ret x 153 end 154 ret or shl x n shr x sub 32 n 155 end 156 fn tr64 x ulong n ulong to ulong 157 if eq n 0 158 ret x 159 end 160 ret or shr x n shl x sub 64 n 161 end 162 fn tl64 x ulong n ulong to ulong 163 if eq n 0 164 ret x 165 end 166 ret or shl x n shr x sub 64 n 167 end