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.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.om` 119 lines ยท 2387 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note Contract section 3 lines 76-83 (rotr/rotl). Property: for x of uchar, ushort, uint and ulong, 3 note rotr x n and rotl x n give the rotation of the w-bit pattern, n = 0 is the identity. Constant n 4 note (line 82: one ROR immediate for uint/ulong) and run-time n through rr*/rl* (range check, RORV) 5 note for n = 0, 1, a middle value, w-1; then a run-time sweep of every n in 0..w-1. Each x has w 6 note distinct rotations, so n+1, w-n and ROR-for-ROL lowerings change some line. 7 note Expected stdout: oracle/s3s4/exp/rot-values.out (python3, oracle/s3s4/oracle.py). 8 om2 9 fn rr8 x uchar n uchar to uchar 10 ret rotr x n 11 end 12 fn rl8 x uchar n uchar to uchar 13 ret rotl x n 14 end 15 fn rr16 x ushort n ushort to ushort 16 ret rotr x n 17 end 18 fn rl16 x ushort n ushort to ushort 19 ret rotl x n 20 end 21 fn rr32 x uint n uint to uint 22 ret rotr x n 23 end 24 fn rl32 x uint n uint to uint 25 ret rotl x n 26 end 27 fn rr64 x ulong n ulong to ulong 28 ret rotr x n 29 end 30 fn rl64 x ulong n ulong to ulong 31 ret rotl x n 32 end 33 fn main to int 34 a = uchar 177 35 pu ulong rotr a 0 36 pu ulong rotr a 1 37 pu ulong rotr a 3 38 pu ulong rotr a 7 39 pu ulong rotl a 0 40 pu ulong rotl a 1 41 pu ulong rotl a 3 42 pu ulong rotl 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 rotr b 0 57 pu ulong rotr b 1 58 pu ulong rotr b 5 59 pu ulong rotr b 15 60 pu ulong rotl b 0 61 pu ulong rotl b 1 62 pu ulong rotl b 5 63 pu ulong rotl 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 rotr c 0 78 pu ulong rotr c 1 79 pu ulong rotr c 13 80 pu ulong rotr c 31 81 pu ulong rotl c 0 82 pu ulong rotl c 1 83 pu ulong rotl c 13 84 pu ulong rotl 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 rotr d 0 99 pu rotr d 1 100 pu rotr d 29 101 pu rotr d 63 102 pu rotl d 0 103 pu rotl d 1 104 pu rotl d 29 105 pu rotl 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