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: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Sub-10-cycle hardware kernel (784867/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 784867/200000 cycles/op
Latency: 24527/20000 ns/op
Throughput: 20000000/24527 ops/us
Compiled ELF64 .text: 11 B (5 x86_64 insns)
C64 64KB RAM Budget: 21/16384 (84 B source)
Ternary Vote: + (score 1) | Salience: 2085/26
Pure-Rust Capsule Source Code (84 B)
pub fn tnand(a: i8, b: i8) -> i8 {
    let lo = if a < b { a } else { b };
    -lo
}
rustc -C opt-level=3 x86_64 Disassembly (11 B .text / 5 insns)
tnand:
    mov    eax, esi
    cmp    dil, al
    cmovl    eax, edi
    neg    al
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#20tnand (THIS CAPSULE)
domain: ternary | id: b0b7b00d635337c1d57a09e31e69f943
784867/200000 cyc/op24527/20000 ns/op20000000/24527 ops/us11 B .text (5 insns)+ (1)aye::Peter+Omni(0+1)::aarch64 @ 432Hz
#56kleene_nand
domain: smart-tree | id: 6af09389e8e9818028f479ec1700089e
403171/100000 cyc/op768283/400000 ns/op400000000/768283 ops/us11 B .text (5 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz