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 3-capsule Equivalence Class; useful as a reference or cross-validation peer. Sub-10-cycle hardware kernel (968409/400000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

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

Hardware _rdtsc: 968409/400000 cycles/op
Latency: 525559/800000 ns/op
Throughput: 800000000/525559 ops/us
Compiled ELF64 .text: 122 B (39 x86_64 insns)
C64 64KB RAM Budget: 73/16384 (292 B source)
Ternary Vote: + (score 1) | Salience: 280633/3276
Pure-Rust Capsule Source Code (292 B)
pub const fn isqrt_u64(x: u64) -> u64 {
    if x < 2 {
        return x;
    }
    let shift = (64 - x.leading_zeros()).div_ceil(2);
    let mut g = 1u64 << shift;
    loop {
        let next = (g + x / g) >> 1;
        if next >= g {
            return g;
        }
        g = next;
    }
}
rustc -C opt-level=3 x86_64 Disassembly (122 B .text / 39 insns)
isqrt_u64:
    cmp    rdi, 2
    jae    .LBB7_2
    mov    rax, rdi
    ret
.LBB7_2:
    bsr    rcx, rdi
    inc    ecx
    mov    eax, ecx
    shr    eax
    and    ecx, 1
    add    ecx, eax
    mov    eax, 1
    shl    rax, cl
    jmp    .LBB7_3
.LBB7_6:
    mov    rax, rdi
    xor    edx, edx
    div    rcx
    add    rax, rcx
    shr    rax
    cmp    rax, rcx
    jae    .LBB7_8
.LBB7_3:
    test    rax, rax
    je    .LBB7_9
    mov    rcx, rax
    mov    rax, rdi
    or    rax, rcx
    shr    rax, 32
    jne    .LBB7_6
    mov    eax, edi
    xor    edx, edx
    div    ecx
    add    rax, rcx
    shr    rax
    cmp    rax, rcx
    jb    .LBB7_3
.LBB7_8:
    mov    rax, rcx
    ret
.LBB7_9:
    push    rax
    lea    rdi, [rip + .Lanon.a270e05f789020653a98a620bea8a67e.4]
    call    qword ptr [rip + _RNvNtNtCscNqnBmBaIcL_4core9panicking11panic_const23panic_const_div_by_zero@GOTPCREL]

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#3isqrt_u64
domain: ayecast-x86_64 | id: 7f1678af7926c8e71ba451952565b4b1
482603/200000 cyc/op261913/400000 ns/op400000000/261913 ops/us115 B .text (34 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#4isqrt_u64 (THIS CAPSULE)
domain: smart-tree-x86_64 | id: 87992ac8869b3e30dc8fdd9177f22164
968409/400000 cyc/op525559/800000 ns/op800000000/525559 ops/us122 B .text (39 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#2035isqrt_u64
domain: ayecast-x86_64 | id: 701c3bcfc01cc58fa7b10bec31342152
288519/625 cyc/op10018371/80000 ns/op80000000/10018371 ops/us115 B .text (34 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz