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

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

Hardware _rdtsc: 2154407/400000 cycles/op
Latency: 174103/100000 ns/op
Throughput: 100000000/174103 ops/us
Compiled ELF64 .text: 63 B (19 x86_64 insns)
C64 64KB RAM Budget: 389/65536 (389 B source)
Ternary Vote: + (score 1) | Salience: 10771/117
Pure-Rust Capsule Source Code (389 B)
pub fn outreach_char_budget_trit_gate(char_len: u64, citation_count: u64, slop_hits: u64) -> u64 {
    if char_len == 0 || char_len > 300 || citation_count == 0 || slop_hits > 0 {
        return 0;
    }
    let headroom = 300 - char_len;
    let capped_citations = if citation_count > 16 { 16 } else { citation_count };
    headroom.saturating_add(capped_citations.saturating_mul(1024))
}
rustc -C opt-level=3 x86_64 Disassembly (63 B .text / 19 insns)
outreach_char_budget_trit_gate:
    lea    rax, [rdi - 301]
    cmp    rax, -300
    setb    al
    test    rsi, rsi
    sete    cl
    test    rdx, rdx
    setne    dl
    or    dl, cl
    or    dl, al
    je    .LBB7_2
    xor    eax, eax
    ret
.LBB7_2:
    cmp    rsi, 16
    mov    eax, 16
    cmovb    rax, rsi
    shl    eax, 10
    sub    rax, rdi
    add    rax, 300
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#44outreach_char_budget_trit_gate (THIS CAPSULE)
domain: routing | id: 0d7a31b62645870092a478e6d7f7b17f
2154407/400000 cyc/op174103/100000 ns/op100000000/174103 ops/us63 B .text (19 insns)+ (1)aye-aurora-8b-voice @ 432Hz