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: Sole canonical implementation for its 64-vector functional equivalence class. Sub-10-cycle hardware kernel (960779/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u64,u64)->u32` — wire matching input pins via `snap_dag` or `snap_pipeline`.
.text: 93 B (21 x86_64 insns)75 B)pub fn hamming_distance(a: u64, b: u64) -> u32 {
(a ^ b).count_ones()
}
rustc -C opt-level=3 x86_64 Disassembly (93 B .text / 21 insns)hamming_distance:
xor rdi, rsi
mov rax, rdi
shr rax
movabs rcx, 6148914691236517205
and rcx, rax
sub rdi, rcx
movabs rax, 3689348814741910323
mov rcx, rdi
and rcx, rax
shr rdi, 2
and rax, rdi
add rax, rcx
mov rcx, rax
shr rcx, 4
add rcx, rax
movabs rdx, 1085102592571150095
and rdx, rcx
movabs rax, 72340172838076673
imul rax, rdx
shr rax, 56
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #66 | hamming_distance (THIS CAPSULE) domain: smart-tree | id: 34750981dc46d51103150e816652ff29 | 960779/200000 cyc/op | 11441/5000 ns/op | 5000000/11441 ops/us | 93 B .text (21 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |