Best Use & Engineering Application Guide

Engineering Category: SWAR Pixel Processing & Vision Kernels

Best Use in Production: Branchless in-register pixel averaging, color-space conversion, and edge gradient filtering for zero-copy framebuffers.

When to Select This Capsule: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Sub-10-cycle hardware kernel (241321/100000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 241321/100000 cycles/op
Latency: 26193/40000 ns/op
Throughput: 40000000/26193 ops/us
Compiled ELF64 .text: 41 B (12 x86_64 insns)
C64 64KB RAM Budget: 277/65536 (277 B source)
Ternary Vote: + (score 1) | Salience: 16565/182
Pure-Rust Capsule Source Code (277 B)
pub const fn compute_rgba8_byte_length_checked(width: u32, height: u32) -> u64 { const MAX_IMAGE_BYTE_LENGTH: u64 = 2_147_483_647; let total = 4u64.saturating_mul(width as u64).saturating_mul(height as u64); if total == 0 || total > MAX_IMAGE_BYTE_LENGTH { 0 } else { total } }
rustc -C opt-level=3 x86_64 Disassembly (41 B .text / 12 insns)
compute_rgba8_byte_length_checked:
    mov    eax, edi
    shl    rax, 2
    mov    ecx, esi
    mul    rcx
    seto    cl
    lea    rdx, [rax - 2147483648]
    xor    esi, esi
    cmp    rdx, -2147483647
    cmovb    rax, rsi
    test    cl, cl
    cmovne    rax, rsi
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#5compute_rgba8_byte_length_checked (THIS CAPSULE)
domain: ayecast-x86_64 | id: 61042e4026d081148126d4a7eabce8c8
241321/100000 cyc/op26193/40000 ns/op40000000/26193 ops/us41 B .text (12 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#18compute_rgba8_byte_length_checked
domain: ayecast-x86_64 | id: caf4491ff0d660b9f9acf244f9e03f4d
801311/200000 cyc/op217433/200000 ns/op200000000/217433 ops/us41 B .text (12 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz