Best Use & Engineering Application Guide

Engineering Category: Lossless Wire & Structural Compression

Best Use in Production: Run-length packing of AST or directory depth tokens into single-word frames for compact structural context serialization.

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

Snap-Circuit Wiring Role: 1-to-1 Unary Transform Stage `(u64)->u64` — snaps directly into linear pipelines or fan-out DAG branches.

Hardware _rdtsc: 9813731/400000 cycles/op
Latency: 79303/10000 ns/op
Throughput: 10000000/79303 ops/us
Compiled ELF64 .text: 442 B (134 x86_64 insns)
C64 64KB RAM Budget: 161/16384 (644 B source)
Ternary Vote: 0 (score 0) | Salience: 7493435/82368
Pure-Rust Capsule Source Code (644 B)
pub fn smart_tree_marqant_token_pack(node_word: u64) -> u64 {
    let mut packed: u64 = 0;
    let mut prev_depth: u64 = 0xFF;
    let mut run_len: u64 = 0;
    let mut slot: u32 = 0;
    while slot < 8 {
        let depth = (node_word >> (slot * 8)) & 0x1F;
        let kind = (node_word >> (slot * 8 + 5)) & 0x07;
        if depth == prev_depth && run_len < 7 {
            run_len += 1;
        } else {
            prev_depth = depth;
            run_len = 1;
        }
        let token = ((depth & 0x0F) << 4) | ((kind & 0x03) << 2) | (run_len & 0x03);
        packed |= (token & 0xFF) << (slot * 8);
        slot += 1;
    }
    packed
}
rustc -C opt-level=3 x86_64 Disassembly (442 B .text / 134 insns)
smart_tree_marqant_token_pack:
    mov    esi, edi
    and    esi, 31
    mov    eax, edi
    shl    eax, 4
    movzx    eax, al
    mov    edx, edi
    shr    edx, 3
    and    edx, 12
    or    edx, eax
    mov    r8, rdi
    shr    r8, 8
    mov    eax, r8d
    and    eax, 31
    xor    ecx, ecx
    cmp    rax, rsi
    sete    cl
    shl    r8d, 4
    movzx    esi, r8b
    mov    r8d, edi
    shr    r8d, 11
    and    r8d, 12
    or    r8d, esi
    or    r8d, ecx
    shl    r8d, 8
    mov    r9, rdi
    shr    r9, 16
    mov    esi, r9d
    and    esi, 31
    or    rcx, 2
    cmp    rsi, rax
    mov    eax, 1
    cmovne    rcx, rax
    add    r8d, edx
    add    r8d, 256
    shl    r9d, 4
    movzx    r9d, r9b
    mov    edx, edi
    shr    edx, 19
    and    edx, 12
    or    edx, r9d
    or    edx, ecx
    shl    edx, 16
    or    edx, r8d
    mov    r8, rdi
    shr    r8, 24
    mov    r9d, r8d
    and    r9d, 31
    inc    rcx
    cmp    r9, rsi
    cmovne    rcx, rax
    shl    r8d, 4
    mov    r10d, edi
    shr    r10d, 27
    and    r10d, 12
    or    r10d, r8d
    mov    esi, ecx
    and    esi, 3
    or    esi, r10d
    shl    esi, 24
    or    esi, edx
    mov    rdx, rdi
    shr    rdx, 32
    mov    r8d, edx
    and    r8d, 31
    inc    rcx
    cmp    r8, r9
    cmovne    rcx, rax
    shl    edx, 4
    movzx    edx, dl
    mov    r9, rdi
    shr    r9, 35
    and    r9d, 12
    or    r9d, edx
    mov    edx, ecx
    and    edx, 3
    or    edx, r9d
    shl    rdx, 32
    or    rdx, rsi
    mov    r9, rdi
    shr    r9, 40
    mov    esi, r9d
    and    esi, 31
    inc    rcx
    cmp    rsi, r8
    cmovne    rcx, rax
    shl    r9d, 4
    movzx    r8d, r9b
    mov    r9, rdi
    shr    r9, 43
    and    r9d, 12
    or    r9d, r8d
    mov    r8d, ecx
    and    r8d, 3
    or    r8d, r9d
    shl    r8, 40
    or    r8, rdx
    mov    r9, rdi
    shr    r9, 48
    mov    edx, r9d
    and    edx, 31
    inc    rcx
    cmp    rdx, rsi
    cmovne    rcx, rax
    shl    r9d, 4
    movzx    eax, r9b
    mov    r9, rdi
    shr    r9, 51
    and    r9d, 12
    or    r9d, eax
    mov    esi, ecx
    and    esi, 3
    or    esi, r9d
    shl    rsi, 48
    or    rsi, r8
    mov    r8, rdi
    shr    r8, 56
    mov    r9d, r8d
    and    r9d, 31
    lea    eax, [rcx + 1]
    shl    r8d, 4
    shr    rdi, 59
    and    edi, 12
    or    r8d, edi
    and    eax, 3
    cmp    rcx, 7
    mov    ecx, 1
    cmovae    eax, ecx
    cmp    r9d, edx
    cmovne    eax, ecx
    or    eax, r8d
    shl    rax, 56
    or    rax, rsi
    or    rax, 1
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#74st_golf_marqant_token_pack_swar_u64
domain: smart-tree | id: 2dd83c858706d9578b0681f75a2df2bb
1895849/200000 cyc/op514333/200000 ns/op200000000/514333 ops/us209 B .text (52 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#1690smart_tree_marqant_token_pack (THIS CAPSULE)
domain: smart-tree | id: c46b63760991a5e2ae0d998566749757
9813731/400000 cyc/op79303/10000 ns/op10000000/79303 ops/us442 B .text (134 insns)0 (0)aye-core-8b @ 432Hz