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: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Multi-step compute kernel (3614829/100000 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.
.text: 80 B (33 x86_64 insns)303 B)pub const fn fast_isqrt_u32(n: u32) -> u32 {
if n < 2 {
return n;
}
let shift = (32 - n.leading_zeros()) >> 1;
let mut x = 1u32 << shift;
x = (x + n / x) >> 1;
x = (x + n / x) >> 1;
x = (x + n / x) >> 1;
if x * x > n {
x - 1
} else {
x
}
}
rustc -C opt-level=3 x86_64 Disassembly (80 B .text / 33 insns)fast_isqrt_u32:
cmp edi, 2
jb .LBB7_3
bsr ecx, edi
inc ecx
shr ecx
mov eax, 1
shl eax, cl
mov esi, edi
shr esi, cl
add esi, eax
shr esi
mov eax, edi
xor edx, edx
div esi
mov ecx, eax
add ecx, esi
shr ecx
je .LBB7_4
mov eax, edi
xor edx, edx
div ecx
add eax, ecx
shr eax
mov ecx, eax
imul ecx, eax
cmp edi, ecx
sbb eax, 0
mov edi, eax
.LBB7_3:
mov eax, edi
ret
.LBB7_4:
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 |
|---|---|---|---|---|---|---|---|
| #1704 | fast_isqrt_u32 (THIS CAPSULE) domain: smart-tree | id: e151a0889b6c59d38202cd8879b68d6a | 3614829/100000 cyc/op | 3443127/200000 ns/op | 200000000/3443127 ops/us | 80 B .text (33 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #1710 | isqrt_u32 domain: smart-tree | id: 3adfa168e10d48d8f9e9a754e38288f2 | 626969/12500 cyc/op | 2388583/100000 ns/op | 100000000/2388583 ops/us | 79 B .text (24 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |