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/CUDApp/blob/main/tests/nvml/abi.om # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. 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 `CUDApp / tests / nvml / abi.om` 759 lines · 15835 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note tests/nvml/abi.om: the 55 NVML ABI facts the CUDA++ subset depends on, in seeded Omega. It 3 note replaces the former C driver tests/nvml/abi.c and is composed after gate.om (mk/nvml.mk), which 4 note calls na_facts once per header. The ORACLE tools see no C source: cc compiles /dev/null with 5 note `-include HEADER -g3 -fno-eliminate-unused-debug-types`, and readelf lists the object's DWARF 6 note types (--debug-dump=info) and macros (--debug-dump=macro). This unit reads both listings and 7 note writes one fact per line in the former abi.c format: `sizeof(T) N`, `offsetof(T, f) N`, or 8 note `NAME N` for an enumerator or an integer macro. A fact that is missing, ambiguous or not a 9 note plain integer refuses the gate (CUDAPP-NVML HOST FAIL, exit 1). 10 note NaSpec rows: `S T` is sizeof T, `O T f` is offsetof(T, f), `V NAME` is a value. 11 text NaSpec "S nvmlDevice_t\nS nvmlReturn_t\nS nvmlTemperatureSensors_t\nS nvmlUtilization_t\nO nvmlUtilization_t gpu\nO nvmlUtilization_t memory\nS nvmlMemory_t\nO nvmlMemory_t total\nO nvmlMemory_t free\nO nvmlMemory_t used\nS nvmlProcessInfo_t\nO nvmlProcessInfo_t pid\nO nvmlProcessInfo_t usedGpuMemory\nO nvmlProcessInfo_t gpuInstanceId\nO nvmlProcessInfo_t computeInstanceId\nS nvmlProcessInfo_v2_t\nV NVML_VALUE_NOT_AVAILABLE\nV NVML_TEMPERATURE_GPU\nV NVML_TEMPERATURE_COUNT\nV NVML_DEVICE_NAME_BUFFER_SIZE\nV NVML_DEVICE_NAME_V2_BUFFER_SIZE\nV NVML_DEVICE_UUID_BUFFER_SIZE\nV NVML_DEVICE_UUID_V2_BUFFER_SIZE\nV NVML_SUCCESS\nV NVML_ERROR_UNINITIALIZED\nV NVML_ERROR_INVALID_ARGUMENT\nV NVML_ERROR_NOT_SUPPORTED\nV NVML_ERROR_NO_PERMISSION\nV NVML_ERROR_ALREADY_INITIALIZED\nV NVML_ERROR_NOT_FOUND\nV NVML_ERROR_INSUFFICIENT_SIZE\nV NVML_ERROR_INSUFFICIENT_POWER\nV NVML_ERROR_DRIVER_NOT_LOADED\nV NVML_ERROR_TIMEOUT\nV NVML_ERROR_IRQ_ISSUE\nV NVML_ERROR_LIBRARY_NOT_FOUND\nV NVML_ERROR_FUNCTION_NOT_FOUND\nV NVML_ERROR_CORRUPTED_INFOROM\nV NVML_ERROR_GPU_IS_LOST\nV NVML_ERROR_RESET_REQUIRED\nV NVML_ERROR_OPERATING_SYSTEM\nV NVML_ERROR_LIB_RM_VERSION_MISMATCH\nV NVML_ERROR_IN_USE\nV NVML_ERROR_MEMORY\nV NVML_ERROR_NO_DATA\nV NVML_ERROR_VGPU_ECC_NOT_SUPPORTED\nV NVML_ERROR_INSUFFICIENT_RESOURCES\nV NVML_ERROR_FREQ_NOT_SUPPORTED\nV NVML_ERROR_ARGUMENT_VERSION_MISMATCH\nV NVML_ERROR_DEPRECATED\nV NVML_ERROR_NOT_READY\nV NVML_ERROR_GPU_NOT_FOUND\nV NVML_ERROR_INVALID_STATE\nV NVML_ERROR_RESET_TYPE_NOT_SUPPORTED\nV NVML_ERROR_UNKNOWN\n" 12 text NaG3 "-g3" 13 text NaFeu "-fno-eliminate-unused-debug-types" 14 text NaInc "-include" 15 text NaLx "-x" 16 text NaNull "/dev/null" 17 text NaDi "--debug-dump=info" 18 text NaDm "--debug-dump=macro" 19 text NaObj "build/nvml/abi.o" 20 text NaInfo "build/nvml/abi.info" 21 text NaMacr "build/nvml/abi.mac" 22 text NaBadH "build/nvml/abi-bad.h" 23 text NaBadT "build/nvml/abi-bad.txt" 24 text NaWideF " unsigned int gpuInstanceId;" 25 text NaWideT " unsigned long long gpuInstanceId;" 26 text NaNegOk "PASS abi negative control (a copy of the generated nvml.h with gpuInstanceId widened to 64 bits gives different facts)\n" 27 text NaLneg "abi negative control edit)\n" 28 text NaLfac "abi fact missing, ambiguous or not an integer in the DWARF listing)\n" 29 text NaLcnt "abi fact count)\n" 30 text NaTagP "(DW_TAG_" 31 text NaAtP "DW_AT_" 32 text NaAName "DW_AT_name" 33 text NaASize "DW_AT_byte_size" 34 text NaAType "DW_AT_type" 35 text NaALoc "DW_AT_data_member_location" 36 text NaAVal "DW_AT_const_value" 37 text NaTTd "typedef)" 38 text NaTPtr "pointer_type)" 39 text NaTSt "structure_type)" 40 text NaTMem "member)" 41 text NaTEt "enumeration_type)" 42 text NaTEn "enumerator)" 43 text NaMDef "DW_MACRO_define" 44 text NaMUnd "DW_MACRO_undef" 45 text NaMac " macro : " 46 text NaSzP "sizeof(" 47 text NaOfP "offsetof(" 48 text NaCom ", " 49 text NaRp ") " 50 text NaSp1 " " 51 const NaNone ulong `18446744073709551615` 52 const NaCap ulong 16384 53 note DIE table, one row per DWARF entry in listing order: offset, depth, tag (1 typedef, 2 pointer, 54 note 3 structure, 4 member, 5 enumeration, 6 enumerator, 0 other), name span in the listing, 55 note byte size, type reference, member offset, and a constant value with its present flag. 56 global NaOff ulong 16384 57 global NaDep ulong 16384 58 global NaTag ulong 16384 59 global NaNs ulong 16384 60 global NaNl ulong 16384 61 global NaSz ulong 16384 62 global NaTy ulong 16384 63 global NaLoc ulong 16384 64 global NaVal ulong 16384 65 global NaVf ulong 16384 66 global NaDn ulong 1 67 note Macro table: name span, value span, 1 define or 0 undef. 68 global NaMs ulong 16384 69 global NaMl ulong 16384 70 global NaVs ulong 16384 71 global NaVl ulong 16384 72 global NaMd ulong 16384 73 global NaMn ulong 1 74 global NaOut uchar 65536 75 global NaK ulong 1 76 global NaCnt ulong 1 77 global NaHit ulong 1 78 79 note Facts of one header (path hdr, hn bytes) into the facts file out. Exits 90 on any tool refusal. 80 fn na_facts hdr view uchar * hn ulong fo view uchar * to void 81 na_tools hdr hn 82 na_parse 83 na_flush fo 84 end 85 86 note cc and readelf: build/nvml/abi.info and build/nvml/abi.mac for one header. 87 fn na_tools hdr view uchar * hn ulong to void 88 ng_cc 89 hp_arg NaG3 len NaG3 90 hp_arg NaFeu len NaFeu 91 hp_arg NaInc len NaInc 92 hp_arg hdr hn 93 hp_arg NgDashC len NgDashC 94 hp_arg NaLx len NaLx 95 hp_arg NgC len NgC 96 hp_arg NaNull len NaNull 97 hp_arg NgDashO len NgDashO 98 hp_arg NaObj len NaObj 99 hp_exec -1 -1 0 100 hp_start NgRe len NgRe 101 hp_arg NaDi len NaDi 102 hp_arg NaObj len NaObj 103 ng_exec NaInfo 0 104 hp_start NgRe len NgRe 105 hp_arg NaDm len NaDm 106 hp_arg NaObj len NaObj 107 ng_exec NaMacr 0 108 end 109 110 note Both listings into the DIE and macro tables, then the NaSpec facts into NaOut. 111 fn na_parse to void 112 info = new uchar `1048576` 0 113 mac = new uchar 262144 0 114 n = hp_read NaInfo len NaInfo info len info 115 m = hp_read NaMacr len NaMacr mac len mac 116 hp_require gt n 0 117 hp_require gt m 0 118 put NaDn 0 0 119 put NaMn 0 0 120 na_lines part info 0 n 0 121 na_lines part mac 0 m 1 122 put NaK 0 0 123 put NaCnt 0 0 124 na_spec part info 0 n part mac 0 m 125 ng_need eq get NaCnt 0 55 NaLcnt 126 end 127 128 fn na_flush fo view uchar * to void 129 o = new uchar 65536 0 130 k = get NaK 0 131 for i ulong k 132 put o i get NaOut i 133 end 134 hp_write fo len fo o k 135 end 136 137 note kind 0: a DWARF info listing (DIE headers and attributes); kind 1: a macro listing. 138 fn na_lines t view uchar * kind ulong to void 139 p = ulong 0 140 while lt p len t bound 999999 141 q = na_eol t p 142 if eq kind 0 143 na_die t p q 144 na_attr t p q 145 else 146 na_mline t p q 147 end 148 p = add q 1 149 end 150 end 151 152 fn na_eol t view uchar * p ulong to ulong 153 q = p 154 while lt q len t bound 999999 155 if eq get t q 10 156 ret q 157 end 158 q = add q 1 159 end 160 ret q 161 end 162 163 fn na_tok t view uchar * s ulong q ulong to ulong 164 k = s 165 while lt k q bound 999999 166 if eq get t k 32 167 ret k 168 end 169 k = add k 1 170 end 171 ret q 172 end 173 174 fn na_find t view uchar * p ulong q ulong w view uchar * to ulong 175 i = p 176 while lt i q bound 999999 177 if le add i len w q 178 if ng_at t i w 179 ret i 180 end 181 end 182 i = add i 1 183 end 184 ret q 185 end 186 187 fn na_hv c ulong to ulong 188 if and ge c 48 le c 57 189 ret sub c 48 190 end 191 if and ge c 97 le c 102 192 ret sub c 87 193 end 194 ret 16 195 end 196 197 note Lowercase hex digits from i up to the first other byte; NaNone without a digit or past 16. 198 fn na_hex t view uchar * i ulong q ulong to ulong 199 v = ulong 0 200 k = i 201 while lt k q bound 999999 202 x = na_hv ulong get t k 203 if eq x 16 204 break 205 end 206 if ge sub k i 16 207 ret NaNone 208 end 209 v = add mul v 16 x 210 k = add k 1 211 end 212 if eq k i 213 ret NaNone 214 end 215 ret v 216 end 217 218 note Exactly the bytes v..q-1 as an unsigned decimal of at most 19 digits, else NaNone. 219 fn na_dec t view uchar * v ulong q ulong to ulong 220 if ge v q 221 ret NaNone 222 end 223 if gt sub q v 19 224 ret NaNone 225 end 226 x = ulong 0 227 k = v 228 while lt k q bound 999999 229 c = ulong get t k 230 if or lt c 48 gt c 57 231 ret NaNone 232 end 233 x = add mul x 10 sub c 48 234 k = add k 1 235 end 236 ret x 237 end 238 239 note A DIE header line: " : Abbrev Number: K (DW_TAG_NAME)". A null entry has no tag. 240 fn na_die t view uchar * p ulong q ulong to void 241 if lt sub q p 8 242 ret 243 end 244 if ne get t p 32 245 ret 246 end 247 if ne get t add p 1 60 248 ret 249 end 250 i = add p 2 251 d = ulong 0 252 while lt i q bound 999999 253 c = ulong get t i 254 if or lt c 48 gt c 57 255 break 256 end 257 d = add mul d 10 sub c 48 258 i = add i 1 259 end 260 if ge add i 2 q 261 ret 262 end 263 if ne get t i 62 264 ret 265 end 266 if ne get t add i 1 60 267 ret 268 end 269 off = na_hex t add i 2 q 270 k = na_find t p q NaTagP 271 if eq k q 272 ret 273 end 274 na_new d off na_tagof t add k len NaTagP 275 end 276 277 fn na_tagof t view uchar * s ulong to ulong 278 if ng_at t s NaTTd 279 ret 1 280 end 281 if ng_at t s NaTPtr 282 ret 2 283 end 284 if ng_at t s NaTSt 285 ret 3 286 end 287 if ng_at t s NaTMem 288 ret 4 289 end 290 if ng_at t s NaTEt 291 ret 5 292 end 293 if ng_at t s NaTEn 294 ret 6 295 end 296 ret 0 297 end 298 299 fn na_new d ulong off ulong tag ulong to void 300 n = get NaDn 0 301 hp_require lt n NaCap 302 put NaOff n off 303 put NaDep n d 304 put NaTag n tag 305 put NaNs n 0 306 put NaNl n 0 307 put NaSz n NaNone 308 put NaTy n NaNone 309 put NaLoc n NaNone 310 put NaVal n 0 311 put NaVf n 0 312 put NaDn 0 add n 1 313 end 314 315 note Start of the text after the last ": " of the line p..q-1, or q. 316 fn na_last t view uchar * p ulong q ulong to ulong 317 if lt sub q p 2 318 ret q 319 end 320 k = sub q 1 321 while gt k p bound 999999 322 if eq get t sub k 1 58 323 if eq get t k 32 324 ret add k 1 325 end 326 end 327 k = sub k 1 328 end 329 ret q 330 end 331 332 note The attribute name w starts at a and ends at a space or a colon. 333 fn na_isat t view uchar * a ulong q ulong w view uchar * to bool 334 e = add a len w 335 if ge e q 336 ret false 337 end 338 if not ng_at t a w 339 ret false 340 end 341 c = get t e 342 if eq c 32 343 ret true 344 end 345 ret eq c 58 346 end 347 348 note An attribute line " DW_AT_NAME : VALUE" of the latest DIE. 349 fn na_attr t view uchar * p ulong q ulong to void 350 n = get NaDn 0 351 if eq n 0 352 ret 353 end 354 a = na_find t p q NaAtP 355 if eq a q 356 ret 357 end 358 v = na_last t p q 359 if eq v q 360 ret 361 end 362 i = sub n 1 363 if na_isat t a q NaAName 364 put NaNs i v 365 put NaNl i sub q v 366 ret 367 end 368 if na_isat t a q NaASize 369 put NaSz i na_dec t v q 370 ret 371 end 372 if na_isat t a q NaAType 373 put NaTy i na_ref t v q 374 ret 375 end 376 if na_isat t a q NaALoc 377 put NaLoc i na_dec t v q 378 ret 379 end 380 if na_isat t a q NaAVal 381 na_sval t v q i 382 end 383 end 384 385 note A type reference "<0xHEX>". 386 fn na_ref t view uchar * v ulong q ulong to ulong 387 if lt sub q v 4 388 ret NaNone 389 end 390 if ne get t v 60 391 ret NaNone 392 end 393 if ne get t add v 1 48 394 ret NaNone 395 end 396 if ne get t add v 2 120 397 ret NaNone 398 end 399 if ne get t sub q 1 62 400 ret NaNone 401 end 402 ret na_hex t add v 3 sub q 1 403 end 404 405 note A constant "N" or "-N"; the DIE keeps its value only when the whole text is an integer. 406 fn na_sval t view uchar * v ulong q ulong i ulong to void 407 sg = eq get t v 45 408 s = v 409 if sg 410 s = add v 1 411 end 412 x = na_dec t s q 413 if eq x NaNone 414 ret 415 end 416 if sg 417 x = sub 0 x 418 end 419 put NaVal i x 420 put NaVf i 1 421 end 422 423 note A macro line "DW_MACRO_define... macro : NAME VALUE" or "DW_MACRO_undef... macro : NAME". 424 fn na_mline t view uchar * p ulong q ulong to void 425 d = ulong 2 426 if lt na_find t p q NaMDef q 427 d = 1 428 end 429 if lt na_find t p q NaMUnd q 430 d = 0 431 end 432 if eq d 2 433 ret 434 end 435 m = na_find t p q NaMac 436 if eq m q 437 ret 438 end 439 s = add m len NaMac 440 e = na_tok t s q 441 if eq e s 442 ret 443 end 444 n = get NaMn 0 445 hp_require lt n NaCap 446 put NaMs n s 447 put NaMl n sub e s 448 put NaMd n d 449 vs = e 450 if lt e q 451 vs = add e 1 452 end 453 put NaVs n vs 454 put NaVl n sub q vs 455 put NaMn 0 add n 1 456 end 457 458 fn na_spec t view uchar * m view uchar * to void 459 p = ulong 0 460 while lt p len NaSpec bound 999999 461 p = na_fact t m p 462 end 463 end 464 465 note One NaSpec row at p: append its fact line; return the next row. 466 fn na_fact t view uchar * m view uchar * p ulong to ulong 467 q = na_eol NaSpec p 468 s = add p 2 469 e = na_tok NaSpec s q 470 c = get NaSpec p 471 put NaHit 0 0 472 if eq c 83 473 na_fs t s e 474 end 475 if eq c 79 476 na_fo t s e q 477 end 478 if eq c 86 479 na_fv t m s e 480 end 481 ng_need eq get NaHit 0 1 NaLfac 482 na_out NgNl 0 1 483 put NaCnt 0 add get NaCnt 0 1 484 ret add q 1 485 end 486 487 fn na_fs t view uchar * s ulong e ulong to void 488 na_out NaSzP 0 len NaSzP 489 na_out NaSpec s sub e s 490 na_out NaRp 0 len NaRp 491 na_outn na_size t s sub e s 492 end 493 494 fn na_fo t view uchar * s ulong e ulong q ulong to void 495 f = add e 1 496 hp_require lt f q 497 na_out NaOfP 0 len NaOfP 498 na_out NaSpec s sub e s 499 na_out NaCom 0 len NaCom 500 na_out NaSpec f sub q f 501 na_out NaRp 0 len NaRp 502 na_outn na_offs t s sub e s f sub q f 503 end 504 505 fn na_fv t view uchar * m view uchar * s ulong e ulong to void 506 na_out NaSpec s sub e s 507 na_out NaSp1 0 1 508 na_outn na_val t m s sub e s 509 end 510 511 fn na_out src view uchar * off ulong n ulong to void 512 k = get NaK 0 513 hp_require le add k n 65536 514 for i ulong n 515 put NaOut add k i get src add off i 516 end 517 put NaK 0 add k n 518 end 519 520 note A value as the C printf("%lld") of its 64 bits. 521 fn na_outn v ulong to void 522 d = new uchar 32 0 523 x = v 524 if ge v `9223372036854775808` 525 na_out HPMinus 0 1 526 x = sub 0 v 527 end 528 n = hp_num x d 529 na_out d 0 n 530 end 531 532 note The name of DIE i, or of macro i, equals the NaSpec name s..s+sl. 533 fn na_dname t view uchar * i ulong s ulong sl ulong to bool 534 ns = get NaNs i 535 nl = get NaNl i 536 ret na_name t ns nl s sl 537 end 538 539 fn na_mname m view uchar * i ulong s ulong sl ulong to bool 540 ns = get NaMs i 541 nl = get NaMl i 542 ret na_name m ns nl s sl 543 end 544 545 note The listing name ns..ns+nl equals the NaSpec name s..s+sl. 546 fn na_name t view uchar * ns ulong nl ulong s ulong sl ulong to bool 547 if ne nl sl 548 ret false 549 end 550 for i ulong nl 551 if ne get t add ns i get NaSpec add s i 552 ret false 553 end 554 end 555 ret true 556 end 557 558 note The one typedef named s..s+sl, else NaNone. 559 fn na_tdef t view uchar * s ulong sl ulong to ulong 560 r = NaNone 561 hits = ulong 0 562 for i ulong get NaDn 0 563 if eq get NaTag i 1 564 if na_dname t i s sl 565 r = i 566 hits = add hits 1 567 end 568 end 569 end 570 if ne hits 1 571 ret NaNone 572 end 573 ret r 574 end 575 576 fn na_byoff off ulong to ulong 577 for i ulong get NaDn 0 578 if eq get NaOff i off 579 ret i 580 end 581 end 582 ret NaNone 583 end 584 585 note Follow typedefs to the type they name (at most 8 steps). 586 fn na_res i ulong to ulong 587 k = i 588 for step ulong 8 589 if eq k NaNone 590 ret NaNone 591 end 592 if ne get NaTag k 1 593 ret k 594 end 595 r = get NaTy k 596 if eq r NaNone 597 ret NaNone 598 end 599 k = na_byoff r 600 end 601 ret NaNone 602 end 603 604 fn na_size t view uchar * s ulong sl ulong to ulong 605 k = na_res na_tdef t s sl 606 if eq k NaNone 607 ret 0 608 end 609 z = get NaSz k 610 if eq z NaNone 611 ret 0 612 end 613 put NaHit 0 1 614 ret z 615 end 616 617 fn na_offs t view uchar * s ulong sl ulong f ulong fl ulong to ulong 618 k = na_res na_tdef t s sl 619 if eq k NaNone 620 ret 0 621 end 622 if ne get NaTag k 3 623 ret 0 624 end 625 ret na_memb t k f fl 626 end 627 628 note The direct member f..f+fl of the structure DIE k. 629 fn na_memb t view uchar * k ulong f ulong fl ulong to ulong 630 d = get NaDep k 631 j = add k 1 632 while lt j get NaDn 0 bound 999999 633 if le get NaDep j d 634 ret 0 635 end 636 if eq get NaDep j add d 1 637 if eq get NaTag j 4 638 if na_dname t j f fl 639 z = get NaLoc j 640 if eq z NaNone 641 ret 0 642 end 643 put NaHit 0 1 644 ret z 645 end 646 end 647 end 648 j = add j 1 649 end 650 ret 0 651 end 652 653 note An enumerator (exactly one with a constant) or else a macro (exactly one define, no undef). 654 fn na_val t view uchar * m view uchar * s ulong sl ulong to ulong 655 r = ulong 0 656 hits = ulong 0 657 for i ulong get NaDn 0 658 if eq get NaTag i 6 659 if na_dname t i s sl 660 if eq get NaVf i 1 661 r = get NaVal i 662 hits = add hits 1 663 end 664 end 665 end 666 end 667 if eq hits 1 668 put NaHit 0 1 669 ret r 670 end 671 if gt hits 1 672 ret 0 673 end 674 ret na_mval m s sl 675 end 676 677 fn na_mval m view uchar * s ulong sl ulong to ulong 678 r = ulong 0 679 hits = ulong 0 680 for i ulong get NaMn 0 681 if na_mname m i s sl 682 hits = add hits 1 683 r = i 684 end 685 end 686 if ne hits 1 687 ret 0 688 end 689 if ne get NaMd r 1 690 ret 0 691 end 692 ret na_eval m get NaVs r get NaVl r 693 end 694 695 note A macro body N, -N, (N) or (-N), up to 4 levels of parentheses. 696 fn na_eval m view uchar * vs ulong vl ulong to ulong 697 a = vs 698 b = add vs vl 699 for step ulong 4 700 if lt sub b a 3 701 break 702 end 703 if ne get m a 40 704 break 705 end 706 if ne get m sub b 1 41 707 break 708 end 709 a = add a 1 710 b = sub b 1 711 end 712 if ge a b 713 ret 0 714 end 715 sg = eq get m a 45 716 if sg 717 a = add a 1 718 end 719 x = na_dec m a b 720 if eq x NaNone 721 ret 0 722 end 723 put NaHit 0 1 724 if sg 725 ret sub 0 x 726 end 727 ret x 728 end 729 730 note Widen gpuInstanceId in a copy of the generated header; its facts must differ from NVIDIA's. 731 fn na_neg to void 732 h = new uchar 65536 0 733 d = new uchar 65536 0 734 m = hp_read NgCH len NgCH h len h 735 hp_require gt m 0 736 k = na_wide part h 0 m d 737 hp_write NaBadH len NaBadH d k 738 na_facts NaBadH len NaBadH NaBadT 739 hp_require not hp_cmp NaBadT len NaBadT NgCT len NgCT 740 hp_wpart 1 NaNegOk 0 len NaNegOk 741 end 742 743 fn na_wide a view uchar * dst edit uchar 65536 to ulong 744 k = ulong 0 745 hits = ulong 0 746 p = ulong 0 747 while lt p len a bound 999999 748 if ng_at a p NaWideF 749 k = ng_put dst k NaWideT 0 len NaWideT 750 p = add p len NaWideF 751 hits = add hits 1 752 else 753 k = ng_put dst k a p 1 754 p = add p 1 755 end 756 end 757 ng_need eq hits 1 NaLneg 758 ret k 759 end