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: Verified baseline member of a 2-capsule Equivalence Class; useful as a reference or cross-validation peer. Multi-step compute kernel (626969/12500 cyc/op); best used at frame, block, or batch aggregation boundaries.

Snap-Circuit Wiring Role: 1-to-1 Unary Transform Stage `(u32)->u32` — snaps directly into linear pipelines or fan-out DAG branches.

Hardware _rdtsc: 626969/12500 cycles/op
Latency: 2388583/100000 ns/op
Throughput: 100000000/2388583 ops/us
Compiled ELF64 .text: 79 B (24 x86_64 insns)
C64 64KB RAM Budget: 381/65536 (381 B source)
Ternary Vote: + (score 1) | Salience: 1522661/17784
Pure-Rust Capsule Source Code (381 B)
pub const fn isqrt_u32(n: u32) -> u32 {
    if n == 0 {
        return 0;
    }
    let mut x = n;
    let mut y = 0u32;
    let mut bit = 1u32 << 30;
    while bit > x {
        bit >>= 2;
    }
    while bit != 0 {
        if x >= y + bit {
            x -= y + bit;
            y = (y >> 1) + bit;
        } else {
            y >>= 1;
        }
        bit >>= 2;
    }
    y
}
rustc -C opt-level=3 x86_64 Disassembly (79 B .text / 24 insns)
isqrt_u32:
    xor    eax, eax
    test    edi, edi
    je    .LBB7_6
    mov    edx, 1073741824
.LBB7_2:
    mov    ecx, edx
    shr    edx, 2
    cmp    ecx, edi
    ja    .LBB7_2
    test    ecx, ecx
    je    .LBB7_6
    xor    edx, edx
    xor    esi, esi
.LBB7_5:
    lea    r8d, [rsi + rcx]
    shr    esi
    cmp    edi, r8d
    mov    eax, ecx
    cmovb    eax, edx
    cmovb    r8d, edx
    add    eax, esi
    sub    edi, r8d
    shr    ecx, 2
    mov    esi, eax
    jne    .LBB7_5
.LBB7_6:
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1704fast_isqrt_u32
domain: smart-tree | id: e151a0889b6c59d38202cd8879b68d6a
3614829/100000 cyc/op3443127/200000 ns/op200000000/3443127 ops/us80 B .text (33 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1710isqrt_u32 (THIS CAPSULE)
domain: smart-tree | id: 3adfa168e10d48d8f9e9a754e38288f2
626969/12500 cyc/op2388583/100000 ns/op100000000/2388583 ops/us79 B .text (24 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz