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.
.text: 122 B (39 x86_64 insns)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]
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #3 | isqrt_u64 domain: ayecast-x86_64 | id: 7f1678af7926c8e71ba451952565b4b1 | 482603/200000 cyc/op | 261913/400000 ns/op | 400000000/261913 ops/us | 115 B .text (34 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #4 | isqrt_u64 (THIS CAPSULE) domain: smart-tree-x86_64 | id: 87992ac8869b3e30dc8fdd9177f22164 | 968409/400000 cyc/op | 525559/800000 ns/op | 800000000/525559 ops/us | 122 B .text (39 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #2035 | isqrt_u64 domain: ayecast-x86_64 | id: 701c3bcfc01cc58fa7b10bec31342152 | 288519/625 cyc/op | 10018371/80000 ns/op | 80000000/10018371 ops/us | 115 B .text (34 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |