Best Use & Engineering Application Guide

Engineering Category: Lossless Wire & Structural Compression

Best Use in Production: Zero-allocation integer bit-packing, variable-length encoding, and stream framing for sovereign wire protocols.

When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Sub-10-cycle hardware kernel (1234501/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 1234501/200000 cycles/op
Latency: 235211/80000 ns/op
Throughput: 80000000/235211 ops/us
Compiled ELF64 .text: 67 B (20 x86_64 insns)
C64 64KB RAM Budget: 441/65536 (441 B source)
Ternary Vote: + (score 1) | Salience: 71325/884
Pure-Rust Capsule Source Code (441 B)
pub const fn evaluate_stroke_kinematics_q15(handle_mm: u16, seat_mm: u16) -> u32 {
    let h = if handle_mm > 1_600 {
        1_600u32
    } else {
        handle_mm as u32
    };
    let s = if seat_mm > 1_200 {
        1_200u32
    } else {
        seat_mm as u32
    };
    let lhs = h * 3;
    let rhs = s * 4;
    let diff = lhs.abs_diff(rhs);
    let penalty = if diff * 4 >= 32_768 { 32_768 } else { diff * 4 };
    32_768 - penalty
}
rustc -C opt-level=3 x86_64 Disassembly (67 B .text / 20 insns)
evaluate_stroke_kinematics_q15:
    movzx    eax, di
    cmp    eax, 1600
    mov    eax, 1600
    cmovb    eax, edi
    lea    eax, [rax + 2*rax]
    movzx    ecx, si
    cmp    ecx, 1200
    mov    ecx, 1200
    cmovb    ecx, esi
    movzx    eax, ax
    shl    ecx, 2
    movzx    ecx, cx
    mov    edx, ecx
    sub    edx, eax
    mov    esi, eax
    sub    esi, ecx
    cmp    ax, cx
    cmovae    esi, edx
    lea    eax, [4*rsi + 32768]
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#383evaluate_stroke_kinematics_q15 (THIS CAPSULE)
domain: smart-tree | id: 200d27359944b2f3676bf8bcf33e60fb
1234501/200000 cyc/op235211/80000 ns/op80000000/235211 ops/us67 B .text (20 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz