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

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

Hardware _rdtsc: 81583/20000 cycles/op
Latency: 777181/400000 ns/op
Throughput: 400000000/777181 ops/us
Compiled ELF64 .text: 17 B (8 x86_64 insns)
C64 64KB RAM Budget: 145/65536 (145 B source)
Ternary Vote: + (score 1) | Salience: 33395/468
Pure-Rust Capsule Source Code (145 B)
pub fn plan_rows_for(plan_len: usize, cap: u16) -> u16 {
    if plan_len == 0 {
        0
    } else {
        (plan_len as u16).min(cap)
    }
}
rustc -C opt-level=3 x86_64 Disassembly (17 B .text / 8 insns)
plan_rows_for:
    test    rdi, rdi
    je    .LBB7_2
    cmp    si, di
    cmovb    edi, esi
    mov    eax, edi
    ret
.LBB7_2:
    xor    eax, eax
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#54plan_rows_for (THIS CAPSULE)
domain: smart-tree | id: 56f445b8f23747804d51086dd57a045a
81583/20000 cyc/op777181/400000 ns/op400000000/777181 ops/us17 B .text (8 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz