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.
.text: 79 B (24 x86_64 insns)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
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #1704 | fast_isqrt_u32 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 (THIS CAPSULE) 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 |