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

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

Hardware _rdtsc: 1/1 cycles/op
Latency: 5247479/400000 ns/op
Throughput: 400000000/5247479 ops/us
Compiled ELF64 .text: 91 B (27 x86_64 insns)
C64 64KB RAM Budget: 337/65536 (337 B source)
Ternary Vote: + (score 1) | Salience: 36405/416
Pure-Rust Capsule Source Code (337 B)
pub fn zeno_pid_speculative_depth_step(ewma_num: i64, ewma_den: i64, current_k: i64) -> i64 { let safe_den = if ewma_den <= 0 { 100 } else { ewma_den }; let err_scaled = ewma_num * 100 - 65 * safe_den; let delta = (err_scaled * 3) / safe_den; let next_k = current_k + delta; if next_k < 1 { 1 } else if next_k > 8 { 8 } else { next_k } }
rustc -C opt-level=3 x86_64 Disassembly (91 B .text / 27 insns)
zeno_pid_speculative_depth_step:
    mov    rcx, rdx
    test    rsi, rsi
    mov    r8d, 100
    cmovg    r8, rsi
    imul    rax, rdi, 100
    mov    rdx, r8
    shl    rdx, 6
    add    rdx, r8
    sub    rax, rdx
    lea    rax, [rax + 2*rax]
    mov    rdx, rax
    or    rdx, r8
    shr    rdx, 32
    je    .LBB7_1
    cqo
    idiv    r8
    jmp    .LBB7_3
.LBB7_1:
    xor    edx, edx
    div    r8d
.LBB7_3:
    add    rax, rcx
    cmp    rax, 2
    mov    ecx, 1
    cmovge    rcx, rax
    cmp    rcx, 8
    mov    eax, 8
    cmovl    rax, rcx
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1692zeno_pid_speculative_depth_step (THIS CAPSULE)
domain: smart-tree | id: 6800dd3c3403e335ee4c097761b03527
1/1 cyc/op5247479/400000 ns/op400000000/5247479 ops/us91 B .text (27 insns)+ (1)aye::Hue+Omni(0+1)::aarch64 @ 432Hz