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 (502331/100000 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: 502331/100000 cycles/op
Latency: 957213/400000 ns/op
Throughput: 400000000/957213 ops/us
Compiled ELF64 .text: 18 B (6 x86_64 insns)
C64 64KB RAM Budget: 167/65536 (167 B source)
Ternary Vote: + (score 1) | Salience: 9645/104
Pure-Rust Capsule Source Code (167 B)
pub const fn clamp_i64(v: i64, min_v: i64, max_v: i64) -> i64 {
    if v < min_v {
        min_v
    } else if v > max_v {
        max_v
    } else {
        v
    }
}
rustc -C opt-level=3 x86_64 Disassembly (18 B .text / 6 insns)
clamp_i64:
    mov    rax, rdx
    cmp    rdi, rdx
    cmovl    rax, rdi
    cmp    rdi, rsi
    cmovl    rax, rsi
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#240clamp_i64 (THIS CAPSULE)
domain: smart-tree | id: df236abba949ddd4b1863f1415fe682c
502331/100000 cyc/op957213/400000 ns/op400000000/957213 ops/us18 B .text (6 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz