Engineering Category: Exact Integer Number Theory & Transcendentals
Best Use in Production: Hardware-verified modular arithmetic, integer roots, and combinatorial invariants for exact rational math engines and cryptographic primitives.
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 (135541833/200000 cyc/op); best used at frame, block, or batch aggregation boundaries.
Snap-Circuit Wiring Role: 2-to-1 Binary Combiner / Join Stage `(i64,i64)->i64` — ideal for merging two upstream DAG branches, dot products, or pairwise rank fusion.
.text: 148 B (48 x86_64 insns)294 B)pub const fn gcd_i64(mut a: i64, mut b: i64) -> i64 {
if a < 0 {
a = a.saturating_neg();
}
if b < 0 {
b = b.saturating_neg();
}
while b != 0 {
let r = a % b;
a = b;
b = r;
}
if a == 0 {
1
} else {
a
}
}
rustc -C opt-level=3 x86_64 Disassembly (148 B .text / 48 insns)gcd_i64:
mov rax, rdi
test rdi, rdi
js .LBB7_1
test rsi, rsi
js .LBB7_3
.LBB7_4:
test rsi, rsi
jne .LBB7_5
jmp .LBB7_9
.LBB7_1:
xor ecx, ecx
mov rdx, rax
neg rdx
setns cl
movabs rdx, 9223372036854775807
add rdx, rcx
neg rax
cmovo rax, rdx
test rsi, rsi
jns .LBB7_4
.LBB7_3:
xor ecx, ecx
mov rdx, rsi
neg rdx
setns cl
movabs rdx, 9223372036854775807
add rdx, rcx
neg rsi
cmovo rsi, rdx
test rsi, rsi
jne .LBB7_5
jmp .LBB7_9
.LBB7_7:
xor edx, edx
div rsi
mov rax, rsi
mov rsi, rdx
test rdx, rdx
je .LBB7_9
.LBB7_5:
mov rcx, rax
or rcx, rsi
shr rcx, 32
jne .LBB7_7
xor edx, edx
div esi
mov rax, rsi
mov rsi, rdx
test rdx, rdx
jne .LBB7_5
.LBB7_9:
cmp rax, 1
adc rax, 0
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #2030 | gcd_binary_i64 domain: math | id: bbf489200f39dd46b16954913d96fbe1 | 27215567/100000 cyc/op | 1063207/12500 ns/op | 12500000/1063207 ops/us | 201 B .text (53 insns) | + (1) | aye::Peter+Omni(0+1)::aarch64 @ 432Hz |
| #2043 | gcd_i64 (THIS CAPSULE) domain: gemini-diary-x86_64 | id: db0770ddd3c0c6bf15e56d0aafbede66 | 135541833/200000 cyc/op | 4034011/12500 ns/op | 12500000/4034011 ops/us | 148 B .text (48 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |