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/api/apish_trit.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 / api / apish_trit.om` 25 lines · 470 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Sixteen int8 trits, passed as bytes. 1, 0 and 255 (int8 -1) encode to 1, 0, 2. 3 note Any other byte returns bit 32 set. A legal word stays below 2^32. 4 5 fn apishr v view uchar 16 to ulong 6 word = ulong 0 7 for i ulong 16 8 b = get v i 9 code = uint 3 10 if eq b 1 11 code = 1 12 end 13 if eq b 255 14 code = 2 15 end 16 if eq b 0 17 code = 0 18 end 19 if eq code 3 20 ret shl ulong 1 32 21 end 22 word = or word shl ulong code mul i 2 23 end 24 ret word 25 end