Best Use & Engineering Application Guide

Engineering Category: Balanced Ternary & b158 Quantization

Best Use in Production: Packing and unpacking balanced ternary (-1, 0, +1) activation lanes into dense 64-bit registers for C64-constrained inference pipelines.

When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Sub-10-cycle hardware kernel (1417211/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u8)->i8` — wire matching input pins via `snap_dag` or `snap_pipeline`.

Hardware _rdtsc: 1417211/200000 cycles/op
Latency: 1350147/400000 ns/op
Throughput: 400000000/1350147 ops/us
Compiled ELF64 .text: 13 B (4 x86_64 insns)
C64 64KB RAM Budget: 111/65536 (111 B source)
Ternary Vote: + (score 1) | Salience: 4645/52
Pure-Rust Capsule Source Code (111 B)
pub const fn trit_of(digit: u8) -> i8 {
    if digit == 2 {
        -1
    } else {
        digit as i8
    }
}
rustc -C opt-level=3 x86_64 Disassembly (13 B .text / 4 insns)
trit_of:
    cmp    dil, 2
    mov    eax, 255
    cmovne    eax, edi
    ret

Head-to-Head Functional Equivalence Class Peers (1 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#634trit_of (THIS CAPSULE)
domain: smart-tree | id: 82fdd4f2e12a060513b5f3661b84564e
1417211/200000 cyc/op1350147/400000 ns/op400000000/1350147 ops/us13 B .text (4 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz