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

Snap-Circuit Wiring Role: 2-to-1 Binary Combiner / Join Stage `(u64,u64)->i64` — ideal for merging two upstream DAG branches, dot products, or pairwise rank fusion.

Hardware _rdtsc: 1/1 cycles/op
Latency: 2742501/400000 ns/op
Throughput: 400000000/2742501 ops/us
Compiled ELF64 .text: 84 B (26 x86_64 insns)
C64 64KB RAM Budget: 141/32768 (282 B source)
Ternary Vote: + (score 1) | Salience: 15017/156
Pure-Rust Capsule Source Code (282 B)
pub fn ayeos_bonobo_resonance_trit(raw_bytes: u64, packed_bytes: u64) -> i64 {
    if raw_bytes == 0 || packed_bytes == 0 || raw_bytes == packed_bytes {
        0
    } else if raw_bytes.saturating_mul(2) >= packed_bytes.saturating_mul(3) {
        1
    } else {
        -1
    }
}
rustc -C opt-level=3 x86_64 Disassembly (84 B .text / 26 insns)
ayeos_bonobo_resonance_trit:
    xor    eax, eax
    cmp    rdi, rsi
    je    .LBB7_9
    test    rdi, rdi
    je    .LBB7_9
    test    rsi, rsi
    je    .LBB7_9
    test    rdi, rdi
    js    .LBB7_5
    add    rdi, rdi
    mov    ecx, 3
    mov    rax, rsi
    mul    rcx
    jo    .LBB7_7
.LBB7_8:
    xor    ecx, ecx
    cmp    rdi, rax
    setae    cl
    lea    rax, [2*rcx - 1]
.LBB7_9:
    ret
.LBB7_5:
    mov    rdi, -1
    mov    ecx, 3
    mov    rax, rsi
    mul    rcx
    jno    .LBB7_8
.LBB7_7:
    mov    rax, -1
    jmp    .LBB7_8

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1682ayeos_bonobo_resonance_trit (THIS CAPSULE)
domain: ayeos-rpi | id: dd3c6603c13c499fa9ae953a547de802
1/1 cyc/op2742501/400000 ns/op400000000/2742501 ops/us84 B .text (26 insns)+ (1)aye::Peter+Omni(0+1)::aarch64 @ 432Hz