Best Use & Engineering Application Guide

Engineering Category: Lossless Wire & Structural Compression

Best Use in Production: Computing vertical column-ditto masks across consecutive tabular rows with 22/9 Hz coherence tags for high-density telemetry framing.

When to Select This Capsule: Verified baseline member of a 3-capsule Equivalence Class; useful as a reference or cross-validation peer. Low-latency L1-resident kernel (4767397/200000 cyc/op); well-suited for high-frequency pipeline stages.

Snap-Circuit Wiring Role: 2-to-1 Binary Combiner / Join Stage `(u64,u64)->u64` — ideal for merging two upstream DAG branches, dot products, or pairwise rank fusion.

Hardware _rdtsc: 4767397/200000 cycles/op
Latency: 3081949/400000 ns/op
Throughput: 400000000/3081949 ops/us
Compiled ELF64 .text: 410 B (103 x86_64 insns)
C64 64KB RAM Budget: 831/65536 (831 B source)
Ternary Vote: 0 (score 0) | Salience: 278995/3276
Pure-Rust Capsule Source Code (831 B)
pub fn kompress_ditto_mask_scalar(prev_row: u64, curr_row: u64) -> u64 {
    let mut ditto_mask: u64 = 0;
    let mut ditto_count: u64 = 0;
    let mut residual: u64 = 0;
    let mut col: u32 = 0;
    while col < 8 {
        let shift = col * 8;
        let p_byte = (prev_row >> shift) & 0xFF;
        let c_byte = (curr_row >> shift) & 0xFF;
        let mut diff = (p_byte ^ c_byte) as i64;
        let mut is_same: u64 = 1;
        while diff > 0 {
            is_same = 0;
            diff -= 1;
        }
        if is_same == 1 {
            ditto_mask |= 1u64 << col;
            ditto_count += 1;
        } else {
            residual |= c_byte << shift;
        }
        col += 1;
    }
    let love_22_9_tag = (ditto_count * 22) / 9;
    (residual & 0x00FF_FFFF_FFFF_FFFF) | ((ditto_mask ^ (love_22_9_tag << 4)) << 56)
}
rustc -C opt-level=3 x86_64 Disassembly (410 B .text / 103 insns)
kompress_ditto_mask_scalar:
    push    rbx
    xor    rdi, rsi
    xor    edx, edx
    xor    r8d, r8d
    test    dil, dil
    sete    r8b
    movzx    eax, sil
    cmovne    rdx, rax
    mov    eax, edi
    and    eax, 65280
    mov    ecx, esi
    and    ecx, 65280
    mov    r9d, r8d
    inc    r9b
    mov    r10, r8
    shl    r10, 56
    movabs    r11, 144115188075855872
    or    r11, r10
    test    rax, rax
    cmove    rcx, rax
    movzx    eax, r9b
    cmovne    eax, r8d
    cmovne    r11, r10
    or    rcx, rdx
    mov    r8d, edi
    and    r8d, 16711680
    mov    edx, esi
    and    edx, 16711680
    movabs    r9, 288230376151711744
    or    r9, r11
    test    r8, r8
    cmove    rdx, r8
    sete    r10b
    cmovne    r9, r11
    or    rdx, rcx
    mov    ecx, edi
    and    ecx, -16777216
    mov    r8d, esi
    and    r8d, -16777216
    movabs    r11, 576460752303423488
    or    r11, r9
    test    rcx, rcx
    sete    bl
    cmove    r8, rcx
    cmovne    r11, r9
    or    r8, rdx
    add    bl, r10b
    movabs    rcx, 1095216660480
    mov    rdx, rdi
    and    rdx, rcx
    and    rcx, rsi
    movabs    r9, 1152921504606846976
    or    r9, r11
    test    rdx, rdx
    sete    r10b
    cmove    rcx, rdx
    cmovne    r9, r11
    or    rcx, r8
    add    r10b, bl
    movabs    r8, 280375465082880
    mov    r11, rdi
    and    r11, r8
    and    r8, rsi
    movabs    rbx, 2305843009213693952
    or    rbx, r9
    test    r11, r11
    sete    dl
    cmove    r8, r11
    cmovne    rbx, r9
    or    r8, rcx
    add    dl, r10b
    add    dl, al
    movabs    rcx, 71776119061217280
    mov    rax, rdi
    and    rax, rcx
    and    rcx, rsi
    movabs    rsi, 4611686018427387904
    or    rsi, rbx
    test    rax, rax
    cmove    rcx, rax
    sete    al
    cmovne    rsi, rbx
    or    rcx, r8
    shr    rdi, 56
    movabs    r8, -9223372036854775808
    or    r8, rsi
    test    rdi, rdi
    sete    dil
    cmovne    r8, rsi
    add    dil, al
    add    dil, dl
    movzx    eax, dil
    lea    edx, [rax + 4*rax]
    lea    edx, [rax + 4*rdx]
    add    edx, eax
    movzx    eax, dl
    imul    eax, eax, 57
    shr    eax, 9
    shl    rax, 60
    xor    rax, r8
    or    rax, rcx
    pop    rbx
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#58st_golf_kompress_ditto_mask_swar_u64
domain: kompress-super-ultra | id: 0de0a3583ee6430fb9da30cec03b0bc5
174931/25000 cyc/op759369/400000 ns/op400000000/759369 ops/us143 B .text (30 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1689kompress_ditto_mask_scalar (THIS CAPSULE)
domain: kompress-super-ultra | id: 18abb53abda0f71782577f6e0646bbf0
4767397/200000 cyc/op3081949/400000 ns/op400000000/3081949 ops/us410 B .text (103 insns)0 (0)aye-claude @ 639Hz
#1703kompress_ditto_mask_branchless
domain: kompress-super-ultra | id: 3edd2f1ee6da88e697dd2d7daf3e6ccc
11858647/400000 cyc/op766581/80000 ns/op80000000/766581 ops/us427 B .text (109 insns)0 (0)aye-omni-8b @ 639Hz