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. Low-latency L1-resident kernel (6550217/200000 cyc/op); well-suited for high-frequency pipeline stages.
Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8])->u32` — digests raw byte buffers into scalar tokens or checksums.
.text: 136 B (37 x86_64 insns)348 B)pub fn crc32(data: &[u8]) -> u32 {
let mut crc = 0xFFFFFFFF_u32;
for byte in data {
crc ^= (*byte as u32) << 24;
for _ in 0..8 {
if crc & 0x80000000 != 0 {
crc = (crc << 1) ^ 0xEDB88320_u32.reverse_bits();
} else {
crc <<= 1;
}
}
}
!crc
}
rustc -C opt-level=3 x86_64 Disassembly (136 B .text / 37 insns)crc32:
test rsi, rsi
je .LBB7_1
mov eax, -1
cmp rsi, 1
je .LBB7_6
movabs rcx, 9223372036854775806
and rcx, rsi
lea rdx, [rip + .L.crctable]
.LBB7_4:
mov r8d, eax
shl r8d, 8
shr eax, 24
xor al, byte ptr [rdi]
movzx eax, al
xor r8d, dword ptr [rdx + 4*rax]
mov eax, r8d
shl eax, 8
shr r8d, 24
xor r8b, byte ptr [rdi + 1]
movzx r8d, r8b
xor eax, dword ptr [rdx + 4*r8]
add rdi, 2
add rcx, -2
jne .LBB7_4
test sil, 1
je .LBB7_7
.LBB7_6:
mov ecx, eax
shl ecx, 8
shr eax, 24
xor al, byte ptr [rdi]
movzx eax, al
lea rdx, [rip + .L.crctable]
xor ecx, dword ptr [rdx + 4*rax]
mov eax, ecx
.LBB7_7:
not eax
ret
.LBB7_1:
xor eax, eax
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #1702 | crc32 (THIS CAPSULE) domain: smart-tree | id: 356725aeaed0a35c92558b4ad74cee30 | 6550217/200000 cyc/op | 6238771/400000 ns/op | 400000000/6238771 ops/us | 136 B .text (37 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |