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: Verified baseline member of a 2-capsule Equivalence Class; useful as a reference or cross-validation peer. Sub-10-cycle hardware kernel (13789/1600 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 13789/1600 cycles/op
Latency: 205233/50000 ns/op
Throughput: 50000000/205233 ops/us
Compiled ELF64 .text: 80 B (27 x86_64 insns)
C64 64KB RAM Budget: 277/65536 (277 B source)
Ternary Vote: + (score 1) | Salience: 58885/624
Pure-Rust Capsule Source Code (277 B)
pub const fn bonobo_resonance_trit(raw_bytes: u64, compressed_bytes: u64) -> i8 {
    if compressed_bytes > 0 && raw_bytes.saturating_mul(2) >= compressed_bytes.saturating_mul(3) {
        1
    } else if raw_bytes > compressed_bytes {
        0
    } else {
        -1
    }
}
rustc -C opt-level=3 x86_64 Disassembly (80 B .text / 27 insns)
bonobo_resonance_trit:
    test    rsi, rsi
    je    .LBB7_1
    test    rdi, rdi
    js    .LBB7_4
    lea    r8, [rdi + rdi]
    mov    ecx, 3
    mov    rax, rsi
    mul    rcx
    jo    .LBB7_7
.LBB7_6:
    mov    rcx, rax
    mov    al, 1
    cmp    r8, rcx
    jae    .LBB7_9
.LBB7_1:
    xor    eax, eax
    cmp    rsi, rdi
    adc    al, -1
    ret
.LBB7_4:
    mov    r8, -1
    mov    ecx, 3
    mov    rax, rsi
    mul    rcx
    jno    .LBB7_6
.LBB7_7:
    mov    rcx, -1
    mov    al, 1
    cmp    r8, rcx
    jb    .LBB7_1
.LBB7_9:
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#820evaluate_bonobo_resonance
domain: kompress-super-ultra-x86_64 | id: 5da6a52678463aecfa0bc0cce713735b
1802901/200000 cyc/op858819/200000 ns/op200000000/858819 ops/us80 B .text (27 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#883bonobo_resonance_trit (THIS CAPSULE)
domain: smart-tree | id: 70e761311bdcc2f8aba122c9f0c197fc
13789/1600 cyc/op205233/50000 ns/op50000000/205233 ops/us80 B .text (27 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz