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 4-capsule Equivalence Class; useful as a reference or cross-validation peer. Low-latency L1-resident kernel (3886171/200000 cyc/op); well-suited for high-frequency pipeline stages.
Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8])->u64` — digests raw byte buffers into scalar tokens or checksums.
.text: 153 B (42 x86_64 insns)417 B)pub fn xor_fold_scalar(bytes: &[u8]) -> u64 {
let full_words_len = bytes.len() & !7usize;
let mut acc: u64 = 0;
let mut i = 0usize;
while i < full_words_len {
acc ^= (bytes[i] as u64) << ((i & 7) * 8);
i += 1;
}
while i < bytes.len() {
acc ^= bytes[i] as u64;
i += 1;
}
core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::SeqCst);
acc
}
rustc -C opt-level=3 x86_64 Disassembly (153 B .text / 42 insns)xor_fold_scalar:
movabs rdx, 9223372036854775800
and rdx, rsi
je .LBB7_1
mov r8d, 24
xor eax, eax
xor r9d, r9d
.LBB7_6:
movzx r10d, byte ptr [rdi + r9]
lea ecx, [r8 - 24]
and cl, 32
shl r10, cl
xor r10, rax
movzx eax, byte ptr [rdi + r9 + 1]
lea ecx, [r8 - 16]
and cl, 40
shl rax, cl
movzx r11d, byte ptr [rdi + r9 + 2]
lea ecx, [r8 - 8]
and cl, 48
shl r11, cl
xor r11, rax
xor r11, r10
movzx eax, byte ptr [rdi + r9 + 3]
mov ecx, r8d
and cl, 56
shl rax, cl
xor rax, r11
add r9, 4
add r8, 32
cmp rdx, r9
jne .LBB7_6
cmp rdx, rsi
je .LBB7_4
.LBB7_3:
movzx ecx, byte ptr [rdi + rdx]
xor rax, rcx
inc rdx
cmp rdx, rsi
jb .LBB7_3
.LBB7_4:
ret
.LBB7_1:
xor eax, eax
cmp rdx, rsi
jne .LBB7_3
jmp .LBB7_4
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #1637 | wupz_xor_fold domain: smart-tree | id: b1b0f9a58585ab9287dc3d2acdbc79f6 | 277647/20000 cyc/op | 2644609/400000 ns/op | 400000000/2644609 ops/us | 442 B .text (105 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #1648 | reference_fold domain: smart-tree | id: 6ba1e9237f06ee601d37cac7ed14f659 | 1554087/100000 cyc/op | 370067/50000 ns/op | 50000000/370067 ops/us | 192 B .text (58 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #1674 | wupz_xor_fold_bytes domain: 8b-is-x86_64 | id: 6062182496ead4dfeef2de489087d5e2 | 91627/5000 cyc/op | 698261/80000 ns/op | 80000000/698261 ops/us | 512 B .text (121 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #1677 | xor_fold_scalar (THIS CAPSULE) domain: smart-tree | id: 578a8eb4d4145dde7f6c8b036ac555f7 | 3886171/200000 cyc/op | 3701653/400000 ns/op | 400000000/3701653 ops/us | 153 B .text (42 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |