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. Sub-10-cycle hardware kernel (1372747/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u8)->u64` — wire matching input pins via `snap_dag` or `snap_pipeline`.
.text: 42 B (12 x86_64 insns)287 B)pub const fn level_prefix_mask(level: u8) -> u64 {
let lvl = if level > 21 { 21 } else { level };
let intra_bits = (21 - lvl) as u32 * 3;
if intra_bits >= 64 {
0
} else if intra_bits == 0 {
u64::MAX
} else {
!((1u64 << intra_bits) - 1)
}
}
rustc -C opt-level=3 x86_64 Disassembly (42 B .text / 12 insns)level_prefix_mask:
xor eax, eax
mov cl, 21
sub cl, dil
movzx ecx, cl
cmovb ecx, eax
lea ecx, [rcx + 2*rcx]
mov rdx, -1
mov rax, -1
shl rax, cl
cmp dil, 21
cmovae rax, rdx
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #521 | level_prefix_mask (THIS CAPSULE) domain: smart-tree | id: d024f8f51033c51ac89bfc25be4525e0 | 1372747/200000 cyc/op | 163443/50000 ns/op | 50000000/163443 ops/us | 42 B .text (12 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |