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 (100223/25000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 100223/25000 cycles/op
Latency: 763781/400000 ns/op
Throughput: 400000000/763781 ops/us
Compiled ELF64 .text: 21 B (7 x86_64 insns)
C64 64KB RAM Budget: 151/65536 (151 B source)
Ternary Vote: + (score 1) | Salience: 9645/104
Pure-Rust Capsule Source Code (151 B)
pub fn rssi_to_trit(rssi_dbm: i64) -> i8 {
    if rssi_dbm >= -68 {
        1
    } else if rssi_dbm >= -80 {
        0
    } else {
        -1
    }
}
rustc -C opt-level=3 x86_64 Disassembly (21 B .text / 7 insns)
rssi_to_trit:
    xor    ecx, ecx
    cmp    rdi, -80
    sbb    ecx, ecx
    cmp    rdi, -68
    mov    eax, 1
    cmovl    eax, ecx
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#65rssi_to_trit (THIS CAPSULE)
domain: databomb-0-x86_64 | id: 0b8a4101d21693387ddd801095475d98
100223/25000 cyc/op763781/400000 ns/op400000000/763781 ops/us21 B .text (7 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz