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-helix/blob/main/native/univ/uarena.om # omega-helix This project has not described itself yet. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-helix / native / univ / uarena.om` 552 lines ยท 8365 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note native/univ/uarena.om: Dynamic zero-cap memory arenas, OLLMCK04 geometry, RoPE table builder, 3 note and streaming u8/u16/u32 token reader. Works identically on Linux AArch64 and macOS Apple Silicon. 4 5 const UCH ulong 500000 6 const UOPWCAP ulong `1048576` 7 8 global up f64 * 9 global ugd f64 * 10 global um f64 * 11 global uv f64 * 12 global ua f64 * 13 global upa f64 * 14 global ucos f64 * 15 global usin f64 * 16 global ukvc f64 * 17 global uvvc f64 * 18 global ubx ulong * 19 global uby ulong * 20 global ulos f64 * 21 global utmp f64 * 22 global ukv_toks ulong * 23 24 global uarg uchar 4100 25 global upath uchar 4100 26 global upk uchar 8220 27 global uck uchar 524288 28 global uopw uchar `1048576` 29 global ucfd int 1 30 31 fn ucn n ulong to ulong 32 if eq n 0 33 ret 0 34 end 35 ret div add n sub UCH 1 UCH 36 end 37 38 fn uce q ulong n ulong to ulong 39 e = mul add q 1 UCH 40 if gt e n 41 ret n 42 end 43 ret e 44 end 45 46 fn uargp i ulong to ulong 47 r = argread i uarg 0 4096 48 if or le r 0 gt r 4096 49 exit 2 50 end 51 ret ulong r 52 end 53 54 fn uargu i ulong to ulong 55 n = uargp i 56 if gt n 19 57 exit 2 58 end 59 v = ulong 0 60 for k ulong n 61 c = ulong get uarg k 62 if or lt c 48 gt c 57 63 exit 2 64 end 65 v = add mul v 10 sub c 48 66 end 67 ret v 68 end 69 70 fn uofsz ai ulong to ulong 71 n = uargp ai 72 fd = int fopen uarg 0 n 0 0 73 if lt fd 0 74 exit 70 75 end 76 sz = fseek fd 0 2 77 if lt sz 0 78 exit 70 79 end 80 if ne fclose fd 0 81 exit 70 82 end 83 ret ulong sz 84 end 85 86 fn uoprd ai ulong pos ulong off ulong n ulong to ulong 87 plen = uargp ai 88 fd = int fopen uarg 0 plen 0 0 89 if lt fd 0 90 exit 70 91 end 92 got = ulong 0 93 while lt got n bound 999999 94 r = pread fd uopw add off got sub n got long add pos got 95 if lt r 0 96 c = fclose fd 97 exit 70 98 end 99 if eq r 0 100 break 101 end 102 got = add got ulong r 103 end 104 if ne fclose fd 0 105 exit 70 106 end 107 ret got 108 end 109 110 fn ugeom_check to bool 111 for i ulong 8 112 if eq get ug i 0 113 ret false 114 end 115 end 116 if lt get ug 0 2 117 ret false 118 end 119 d = get ug 2 120 h = get ug 3 121 hkv = get ug 4 122 if ne rem d h 0 123 ret false 124 end 125 if or gt hkv h ne rem h hkv 0 126 ret false 127 end 128 e = div d h 129 put ug 8 e 130 put ug 9 mul hkv e 131 fl = get ug 12 132 if and ne and fl 2 0 ne and fl 64 0 133 ret false 134 end 135 if and ne and fl 66 0 ne and fl 32 0 136 ret false 137 end 138 if and ne and fl 1 0 ne rem e 2 0 139 ret false 140 end 141 put ug 28 0 142 put ug 29 0 143 put ug 30 0 144 put ug 31 0 145 if ne and fl 1 0 146 put ug 28 1 147 end 148 if ne and fl 66 0 149 put ug 29 1 150 end 151 if ne and fl 4 0 152 put ug 30 1 153 end 154 if ne and fl 8 0 155 put ug 31 1 156 end 157 ret true 158 end 159 160 fn ugeom_params to bool 161 ll = get ug 6 162 np = get ug 19 163 if gt np 1 164 lc = get ug 18 165 if or eq lc 0 gt add get ug 17 lc ll 166 ret false 167 end 168 put ug 11 add ll mul lc sub np 1 169 else 170 put ug 11 ll 171 end 172 d = get ug 2 173 kvd = get ug 9 174 f = get ug 5 175 wpe = mul get ug 0 d 176 put ug 32 wpe 177 lay0 = wpe 178 if eq get ug 28 0 179 lay0 = add lay0 mul get ug 1 d 180 end 181 put ug 33 lay0 182 o = add add d mul d d mul 2 mul d kvd 183 o = add o mul d d 184 put ug 54 o 185 if eq get ug 31 1 186 o = add o get ug 8 187 put ug 55 o 188 o = add o get ug 8 189 else 190 put ug 55 o 191 end 192 put ug 56 o 193 o = add o d 194 put ug 57 o 195 o = add o mul d f 196 put ug 58 o 197 if eq get ug 29 1 198 o = add o mul d f 199 end 200 put ug 59 o 201 o = add o mul f d 202 put ug 34 o 203 gf = add lay0 mul ll o 204 put ug 35 gf 205 lmh = add gf d 206 put ug 36 lmh 207 if eq get ug 30 1 208 put ug 10 add lmh mul get ug 0 d 209 else 210 put ug 10 lmh 211 end 212 put ug 24 get ug 1 213 tw = ulong 1 214 if gt get ug 0 256 215 tw = 2 216 end 217 if gt get ug 0 65535 218 tw = 4 219 end 220 put ug 25 tw 221 ret true 222 end 223 224 fn ugeom_acts to void 225 t = get ug 1 226 td = mul t get ug 2 227 tkv = mul t get ug 9 228 tf = mul t get ug 5 229 a = add add mul 6 td mul 2 tkv add mul 2 t mul 3 tf 230 if eq get ug 31 1 231 a = add a add add mul t get ug 3 mul t get ug 4 add td tkv 232 end 233 put ug 37 a 234 put ug 38 mul mul get ug 3 t t 235 o = mul get ug 11 a 236 put ug 39 o 237 o = add o td 238 put ug 40 o 239 o = add o t 240 put ug 41 o 241 o = add o td 242 put ug 42 o 243 o = add o mul t get ug 0 244 put ug 43 o 245 o = add o td 246 put ug 44 o 247 o = add o td 248 put ug 45 o 249 o = add o td 250 put ug 46 o 251 o = add o tkv 252 put ug 47 o 253 o = add o tkv 254 put ug 48 o 255 o = add o td 256 put ug 49 o 257 o = add o td 258 put ug 50 o 259 o = add o tf 260 put ug 51 o 261 o = add o tf 262 put ug 52 o 263 end 264 265 fn ugeom_alloc to void 266 p = get ug 10 267 r = enlarge up p 268 if ne r 0 269 exit 70 270 end 271 r = enlarge ugd p 272 if ne r 0 273 exit 70 274 end 275 r = enlarge um p 276 if ne r 0 277 exit 70 278 end 279 r = enlarge uv p 280 if ne r 0 281 exit 70 282 end 283 r = enlarge ua get ug 52 284 if ne r 0 285 exit 70 286 end 287 r = enlarge upa mul get ug 11 get ug 38 288 if ne r 0 289 exit 70 290 end 291 bt = mul get ug 7 get ug 1 292 r = enlarge ubx bt 293 if ne r 0 294 exit 70 295 end 296 r = enlarge uby bt 297 if ne r 0 298 exit 70 299 end 300 r = enlarge ulos get ug 7 301 if ne r 0 302 exit 70 303 end 304 ts = get ug 0 305 if gt get ug 1 ts 306 ts = get ug 1 307 end 308 if gt get ug 2 ts 309 ts = get ug 2 310 end 311 if gt get ug 5 ts 312 ts = get ug 5 313 end 314 r = enlarge utmp add ts 256 315 if ne r 0 316 exit 70 317 end 318 kvsz = mul get ug 11 mul get ug 1 get ug 9 319 r = enlarge ukvc kvsz 320 if ne r 0 321 exit 70 322 end 323 r = enlarge uvvc kvsz 324 if ne r 0 325 exit 70 326 end 327 end 328 329 fn urobe_col i ulong lth f64 to void 330 t = get ug 1 331 he = div get ug 8 2 332 freq = ufexp mul neg lth div f64 mul 2 i f64 get ug 8 333 for pos ulong t 334 ang = mul f64 pos freq 335 idx = add mul pos he i 336 put ucos idx ufcos ang 337 put usin idx ufsin ang 338 end 339 end 340 341 fn urobe_init to void 342 sz = mul get ug 1 div get ug 8 2 343 r = enlarge ucos sz 344 if ne r 0 345 exit 70 346 end 347 r = enlarge usin sz 348 if ne r 0 349 exit 70 350 end 351 th = div f64 get ug 13 1000.0 352 if le th 0.0 353 th = 10000.0 354 end 355 lth = uflog th 356 for i ulong div get ug 8 2 357 urobe_col i lth 358 end 359 end 360 361 fn ugeom to bool 362 if not ugeom_check 363 ret false 364 end 365 if not ugeom_params 366 ret false 367 end 368 ugeom_acts 369 ugeom_alloc 370 if eq get ug 28 1 371 urobe_init 372 end 373 ret true 374 end 375 376 fn ulp l ulong to ulong 377 np = get ug 19 378 if le np 1 379 ret l 380 end 381 lp = get ug 17 382 if lt l lp 383 ret l 384 end 385 lc = get ug 18 386 j = sub l lp 387 if lt j mul lc np 388 ret add lp rem j lc 389 end 390 ret sub l mul lc sub np 1 391 end 392 393 fn up_lay l ulong to ulong 394 ret add get ug 33 mul l get ug 34 395 end 396 fn up_g1 l ulong to ulong 397 ret up_lay l 398 end 399 fn up_wq l ulong to ulong 400 ret add up_lay l get ug 2 401 end 402 fn up_wk l ulong to ulong 403 d = get ug 2 404 ret add up_wq l mul d d 405 end 406 fn up_wv l ulong to ulong 407 ret add up_wk l mul get ug 2 get ug 9 408 end 409 fn up_wo l ulong to ulong 410 ret add up_wv l mul get ug 2 get ug 9 411 end 412 fn up_qn l ulong to ulong 413 ret add up_lay l get ug 54 414 end 415 fn up_kn l ulong to ulong 416 ret add up_lay l get ug 55 417 end 418 fn up_g2 l ulong to ulong 419 ret add up_lay l get ug 56 420 end 421 fn up_w1 l ulong to ulong 422 ret add up_lay l get ug 57 423 end 424 fn up_wup l ulong to ulong 425 ret add up_lay l get ug 58 426 end 427 fn up_w2 l ulong to ulong 428 ret add up_lay l get ug 59 429 end 430 431 fn ua_base l ulong to ulong 432 ret mul l get ug 37 433 end 434 fn ua_hin l ulong to ulong 435 ret ua_base l 436 end 437 fn ua_a l ulong to ulong 438 ret add ua_base l mul get ug 1 get ug 2 439 end 440 fn ua_q l ulong to ulong 441 ret add ua_a l mul get ug 1 get ug 2 442 end 443 fn ua_k l ulong to ulong 444 ret add ua_q l mul get ug 1 get ug 2 445 end 446 fn ua_v l ulong to ulong 447 ret add ua_k l mul get ug 1 get ug 9 448 end 449 fn ua_o l ulong to ulong 450 ret add ua_v l mul get ug 1 get ug 9 451 end 452 fn ua_hmid l ulong to ulong 453 ret add ua_o l mul get ug 1 get ug 2 454 end 455 fn ua_bn l ulong to ulong 456 ret add ua_hmid l mul get ug 1 get ug 2 457 end 458 fn ua_s1 l ulong to ulong 459 ret add ua_bn l mul get ug 1 get ug 2 460 end 461 fn ua_s2 l ulong to ulong 462 ret add ua_s1 l get ug 1 463 end 464 fn ua_f1 l ulong to ulong 465 ret add ua_s2 l get ug 1 466 end 467 fn ua_f2 l ulong to ulong 468 ret add ua_f1 l mul get ug 1 get ug 5 469 end 470 fn ua_f3 l ulong to ulong 471 ret add ua_f2 l mul get ug 1 get ug 5 472 end 473 fn ua_qns l ulong to ulong 474 ret add ua_f3 l mul get ug 1 get ug 5 475 end 476 fn ua_kns l ulong to ulong 477 ret add ua_qns l mul get ug 1 get ug 3 478 end 479 fn ua_qpre l ulong to ulong 480 ret add ua_kns l mul get ug 1 get ug 4 481 end 482 fn ua_kpre l ulong to ulong 483 ret add ua_qpre l mul get ug 1 get ug 2 484 end 485 486 fn udopen ai ulong to void 487 w = get ug 25 488 nb = uofsz ai 489 if ne rem nb w 0 490 exit 21 491 end 492 n = div nb w 493 if le n get ug 1 494 exit 20 495 end 496 put ug 26 ai 497 put ug 27 n 498 end 499 500 fn udtk k ulong to ulong 501 w = get ug 25 502 if eq w 1 503 ret ulong get uopw k 504 end 505 if eq w 2 506 lo = ulong get uopw mul k 2 507 hi = ulong get uopw add mul k 2 1 508 ret or shl hi 8 lo 509 end 510 b = mul k 4 511 v = ulong get uopw b 512 v = or v shl ulong get uopw add b 1 8 513 v = or v shl ulong get uopw add b 2 16 514 v = or v shl ulong get uopw add b 3 24 515 ret v 516 end 517 518 fn udrow o ulong n ulong to void 519 w = get ug 25 520 nb = mul n w 521 if gt nb UOPWCAP 522 exit 21 523 end 524 r = uoprd get ug 26 mul o w 0 nb 525 m = div r w 526 v = get ug 0 527 for k ulong m 528 if ge udtk k v 529 exit 25 530 end 531 end 532 end 533 534 fn ubrow b ulong o ulong to void 535 t = get ug 1 536 udrow o add t 1 537 for j ulong t 538 put ubx add mul b t j udtk j 539 put uby add mul b t j udtk add j 1 540 end 541 end 542 543 fn ubatch s ulong to void 544 bb = get ug 7 545 t = get ug 1 546 n = get ug 27 547 sd = get ug 20 548 for b ulong bb 549 o = rem usmx xor sd mul add mul s bb b `11400714819323198485` sub n t 550 ubrow b o 551 end 552 end