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/om/apirest/pack.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 / om / apirest / pack.om` 91 lines · 1395 bytes Raw Blame History 1 om2 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note Composed with apish_pack.om, preserving its scalar scale and NaN rules. 4 fn ar_nan x view uchar * y edit ulong 2 to ulong 5 n = ulong 0 6 base = ulong 0 7 for chunks ulong `281474976710656` 8 if ge base len x 9 break 10 end 11 for j ulong 65536 12 i = add base j 13 if ge i len x 14 break 15 end 16 if ne isnanb uint get x i 0 17 if eq n 0 18 put y 0 i 19 end 20 n = add n 1 21 end 22 end 23 base = add base 65536 24 end 25 put y 1 n 26 ret 0 27 end 28 fn ar_scale mut ulong x view ushort * y edit f32 * to ulong 29 if ne len x len y 30 ret 1 31 end 32 base = ulong 0 33 for chunks ulong `281474976710656` 34 if ge base len x 35 break 36 end 37 for j ulong 65536 38 i = add base j 39 if ge i len x 40 break 41 end 42 v = scalef uint get x i uint mut 43 if ne shr v 32 0 44 ret 1 45 end 46 put y i bitcast f32 uint v 47 end 48 base = add base 65536 49 end 50 ret 0 51 end 52 fn ar_fold x view f32 * y edit f32 * to ulong 53 if ne len x len y 54 ret 1 55 end 56 base = ulong 0 57 for chunks ulong `281474976710656` 58 if ge base len x 59 break 60 end 61 for j ulong 65536 62 i = add base j 63 if ge i len x 64 break 65 end 66 put y i bitcast f32 xfold bitcast uint get x i 64 67 end 68 base = add base 65536 69 end 70 ret 0 71 end 72 fn ar_foldh x view ushort * y edit f32 * to ulong 73 if ne len x len y 74 ret 1 75 end 76 base = ulong 0 77 for chunks ulong `281474976710656` 78 if ge base len x 79 break 80 end 81 for j ulong 65536 82 i = add base j 83 if ge i len x 84 break 85 end 86 put y i bitcast f32 xfold shl uint get x i 16 64 87 end 88 base = add base 65536 89 end 90 ret 0 91 end