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/gpu/nvidia/om/engine/fixture_rest.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 / gpu / nvidia / om / engine / fixture_rest.om` 162 lines ยท 2352 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Extracted fixture arithmetic; unsigned operations preserve C modulo semantics. 3 note Clock inputs are the uint64_t representations of timespec fields, including negative and overflow edges. 4 note WolframLanguageEvaluator: {Quotient[2^64-1,10^9],Quotient[2^64-1,1000],Mod[2^64-1,10^9]} -> {`18446744073`,`18446744073709551`,`709551615`}. 5 note Constants below are copied from the source fixture or evaluated in the lane evidence. 6 fn fr_bool val bool to ulong 7 if val 8 ret 1 9 end 10 ret 0 11 end 12 13 fn fr_calc op ulong a ulong b ulong c ulong to ulong 14 if eq op 0 15 ret add mul a `1000000000` b 16 end 17 if eq op 1 18 ret add mul a 1000 div b `1000000` 19 end 20 if eq op 2 21 ret add a b 22 end 23 if eq op 3 24 ret sub a b 25 end 26 if eq op 4 27 if gt a b 28 ret a 29 end 30 ret b 31 end 32 if eq op 5 33 ret and a 255 34 end 35 if eq op 6 36 ret and xor a 255 255 37 end 38 if eq op 7 39 ix = rem a 8 40 if eq ix 0 41 ret 4096 42 end 43 if eq ix 1 44 ret 65536 45 end 46 if eq ix 2 47 ret `1048576` 48 end 49 if eq ix 3 50 ret `4194304` 51 end 52 if eq ix 4 53 ret `16777216` 54 end 55 if eq ix 5 56 ret `33554432` 57 end 58 ret `67108864` 59 end 60 if eq op 8 61 ret fr_bool eq rem a 2000 0 62 end 63 if eq op 9 64 if ne a 0 65 ret and add mul b 2 3 `4294967295` 66 end 67 ret 2 68 end 69 if eq op 10 70 ret and mul sub a 1 128 `4294967295` 71 end 72 if eq op 11 73 ret mul a 4 74 end 75 if eq op 12 76 ret sub a 1 77 end 78 if eq op 13 79 ret add add a b c 80 end 81 if eq op 14 82 if ne a 0 83 ret 1 84 end 85 ret 0 86 end 87 if eq op 15 88 ret fr_bool eq a b 89 end 90 if eq op 16 91 ret fr_bool and ne a 0 ne b 0 92 end 93 if eq op 17 94 ret div a `1000000` 95 end 96 if eq op 18 97 ret and sub a 1 `4294967295` 98 end 99 if eq op 19 100 if ne a 0 101 ret 0 102 end 103 ret `4294967295` 104 end 105 ret `18446744073709551615` 106 end 107 108 fn fr_flush ix ulong va ulong to ulong 109 if eq ix 0 110 ret `537133066` 111 end 112 if eq ix 4 113 ret `2147483648` 114 end 115 if eq ix 5 116 ret `537198615` 117 end 118 if eq ix 6 119 ret and add va 16 `4294967295` 120 end 121 if eq ix 7 122 ret shr add va 16 32 123 end 124 if eq ix 8 125 ret `1179010630` 126 end 127 if eq ix 10 128 ret `1048577` 129 end 130 ret 0 131 end 132 133 fn fr_scale val ulong kind uint to f64 134 if eq kind 0 135 ret div f64 val `1073741824`.0 136 end 137 ret div f64 val `1048576`.0 138 end 139 140 note Bounded NUL-terminated text matching. Input transport pads shorter source buffers to 512 bytes. 141 fn fr_text buf view uchar 512 pat view uchar 32 n ulong to ulong 142 if or eq n 0 gt n 32 143 ret 0 144 end 145 for i ulong 512 146 if eq get buf i 0 147 ret 0 148 end 149 if le n sub ulong 512 i 150 same = true 151 for j ulong n 152 if ne get buf add i j get pat j 153 same = false 154 end 155 end 156 if same 157 ret 1 158 end 159 end 160 end 161 ret 0 162 end