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

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

Hardware _rdtsc: 221247/40000 cycles/op
Latency: 526901/200000 ns/op
Throughput: 200000000/526901 ops/us
Compiled ELF64 .text: 9 B (4 x86_64 insns)
C64 64KB RAM Budget: 35/32768 (70 B source)
Ternary Vote: + (score 1) | Salience: 280/3
Pure-Rust Capsule Source Code (70 B)
pub fn zigzag_i32(x: i32) -> u32 {
    ((x << 1) ^ (x >> 31)) as u32
}
rustc -C opt-level=3 x86_64 Disassembly (9 B .text / 4 insns)
zigzag_i32:
    lea    eax, [rdi + rdi]
    sar    edi, 31
    xor    eax, edi
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#243zigzag_i32 (THIS CAPSULE)
domain: smart-tree | id: 8d851c97dde86594f5c26f920bd91f5e
221247/40000 cyc/op526901/200000 ns/op200000000/526901 ops/us9 B .text (4 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz