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

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

Hardware _rdtsc: 1533893/200000 cycles/op
Latency: 182657/50000 ns/op
Throughput: 50000000/182657 ops/us
Compiled ELF64 .text: 79 B (20 x86_64 insns)
C64 64KB RAM Budget: 145/32768 (290 B source)
Ternary Vote: + (score 1) | Salience: 2935/33
Pure-Rust Capsule Source Code (290 B)
pub fn speed_of_sound_mm_per_s(temp_deci_c: i32, humidity_pct: u32) -> u32 {
    let clamped_t = temp_deci_c.clamp(-200, 600);
    let clamped_rh = humidity_pct.min(100) as i32;
    let c_mm_s = 331_300 + (606 * clamped_t) / 10 + 12 * clamped_rh;
    c_mm_s.clamp(310_000, 370_000) as u32
}
rustc -C opt-level=3 x86_64 Disassembly (79 B .text / 20 insns)
speed_of_sound_mm_per_s:
    cmp    edi, -199
    mov    eax, -200
    cmovge    eax, edi
    cmp    eax, 600
    mov    ecx, 600
    cmovl    ecx, eax
    cmp    esi, 100
    mov    eax, 100
    cmovb    eax, esi
    imul    ecx, ecx, 606
    movsxd    rcx, ecx
    imul    rcx, rcx, 1717986919
    mov    rdx, rcx
    shr    rdx, 63
    sar    rcx, 34
    add    ecx, edx
    lea    eax, [rax + 2*rax]
    lea    eax, [rcx + 4*rax]
    add    eax, 331300
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#570speed_of_sound_mm_per_s (THIS CAPSULE)
domain: smart-tree | id: 247538d5a4d7595467ae5ae89897ff0b
1533893/200000 cyc/op182657/50000 ns/op50000000/182657 ops/us79 B .text (20 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz