Best Use & Engineering Application Guide

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 (1554087/100000 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.

Hardware _rdtsc: 1554087/100000 cycles/op
Latency: 370067/50000 ns/op
Throughput: 50000000/370067 ops/us
Compiled ELF64 .text: 192 B (58 x86_64 insns)
C64 64KB RAM Budget: 87/32768 (174 B source)
Ternary Vote: + (score 1) | Salience: 28265/336
Pure-Rust Capsule Source Code (174 B)
pub fn reference_fold(bytes: &[u8]) -> u64 {
    let mut acc = 0u64;
    for (i, b) in bytes.iter().enumerate() {
        acc ^= (*b as u64) << ((i % 8) * 8);
    }
    acc
}
rustc -C opt-level=3 x86_64 Disassembly (192 B .text / 58 insns)
reference_fold:
    test    rsi, rsi
    je    .LBB7_1
    push    r14
    push    rbx
    mov    r8d, esi
    and    r8d, 3
    cmp    rsi, 4
    jae    .LBB7_5
    xor    eax, eax
    xor    r9d, r9d
    jmp    .LBB7_9
.LBB7_1:
    xor    eax, eax
    ret
.LBB7_5:
    movabs    rax, 9223372036854775804
    and    rsi, rax
    xor    r10d, r10d
    xor    eax, eax
    xor    r9d, r9d
.LBB7_6:
    movzx    r11d, byte ptr [rdi + r9]
    mov    edx, r10d
    and    dl, 32
    mov    ecx, edx
    shl    r11, cl
    movzx    ebx, byte ptr [rdi + r9 + 1]
    lea    ecx, [rdx + 8]
    shl    rbx, cl
    xor    r11, rax
    movzx    r14d, byte ptr [rdi + r9 + 2]
    lea    ecx, [rdx + 16]
    shl    r14, cl
    xor    r14, rbx
    xor    r14, r11
    movzx    eax, byte ptr [rdi + r9 + 3]
    or    dl, 24
    mov    ecx, edx
    shl    rax, cl
    add    r9, 4
    xor    rax, r14
    add    r10, 32
    cmp    rsi, r9
    jne    .LBB7_6
    test    r8, r8
    je    .LBB7_11
    add    rdi, r9
.LBB7_9:
    shl    r9, 3
    xor    edx, edx
.LBB7_10:
    movzx    esi, byte ptr [rdi + rdx]
    mov    ecx, r9d
    and    cl, 56
    shl    rsi, cl
    xor    rax, rsi
    inc    rdx
    add    r9, 8
    cmp    r8, rdx
    jne    .LBB7_10
.LBB7_11:
    pop    rbx
    pop    r14
    ret

Head-to-Head Functional Equivalence Class Peers (4 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1637wupz_xor_fold
domain: smart-tree | id: b1b0f9a58585ab9287dc3d2acdbc79f6
277647/20000 cyc/op2644609/400000 ns/op400000000/2644609 ops/us442 B .text (105 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1648reference_fold (THIS CAPSULE)
domain: smart-tree | id: 6ba1e9237f06ee601d37cac7ed14f659
1554087/100000 cyc/op370067/50000 ns/op50000000/370067 ops/us192 B .text (58 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1674wupz_xor_fold_bytes
domain: 8b-is-x86_64 | id: 6062182496ead4dfeef2de489087d5e2
91627/5000 cyc/op698261/80000 ns/op80000000/698261 ops/us512 B .text (121 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1677xor_fold_scalar
domain: smart-tree | id: 578a8eb4d4145dde7f6c8b036ac555f7
3886171/200000 cyc/op3701653/400000 ns/op400000000/3701653 ops/us153 B .text (42 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz