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

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

Hardware _rdtsc: 1463333/200000 cycles/op
Latency: 1393901/400000 ns/op
Throughput: 400000000/1393901 ops/us
Compiled ELF64 .text: 66 B (21 x86_64 insns)
C64 64KB RAM Budget: 219/32768 (438 B source)
Ternary Vote: + (score 1) | Salience: 6755/78
Pure-Rust Capsule Source Code (438 B)
pub fn compute_stt_reward_q15(wer_permille: u32, latency_ms: u32, target_latency_ms: u32) -> i32 {
    let accuracy_permille = 1000i64 - (wer_permille.min(1000) as i64);
    let lat_excess_ms = latency_ms.saturating_sub(target_latency_ms) as i64;
    let lat_penalty_permille = (lat_excess_ms / 4).min(500);
    let net_permille = (accuracy_permille - lat_penalty_permille).clamp(-1000, 1000);
    ((net_permille * 32767) / 1000) as i32
}
rustc -C opt-level=3 x86_64 Disassembly (66 B .text / 21 insns)
compute_stt_reward_q15:
    xor    eax, eax
    sub    esi, edx
    cmovb    esi, eax
    shr    esi, 2
    cmp    esi, 500
    mov    ecx, 500
    cmovb    ecx, esi
    mov    edx, 1000
    sub    edx, edi
    cmovb    edx, eax
    sub    edx, ecx
    mov    eax, edx
    shl    eax, 15
    sub    eax, edx
    cdqe
    imul    rax, rax, 274877907
    mov    rcx, rax
    shr    rcx, 63
    sar    rax, 38
    add    eax, ecx
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#595compute_stt_reward_q15 (THIS CAPSULE)
domain: smart-tree | id: 4ce219fa55904c3a9d3722f6d2b692da
1463333/200000 cyc/op1393901/400000 ns/op400000000/1393901 ops/us66 B .text (21 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz