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 (1463333/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u32,u32,u32)->i32` — wire matching input pins via `snap_dag` or `snap_pipeline`.
.text: 66 B (21 x86_64 insns)438 B)pub fn compute_stt_reward_q15(wer_permille: u32, latency_ms: u32, target_latency_ms: u32) -> i32 {
let accuracy_permille = 1000i64 - (wer_permille.min(1000) as i64);
let lat_excess_ms = latency_ms.saturating_sub(target_latency_ms) as i64;
let lat_penalty_permille = (lat_excess_ms / 4).min(500);
let net_permille = (accuracy_permille - lat_penalty_permille).clamp(-1000, 1000);
((net_permille * 32767) / 1000) as i32
}
rustc -C opt-level=3 x86_64 Disassembly (66 B .text / 21 insns)compute_stt_reward_q15:
xor eax, eax
sub esi, edx
cmovb esi, eax
shr esi, 2
cmp esi, 500
mov ecx, 500
cmovb ecx, esi
mov edx, 1000
sub edx, edi
cmovb edx, eax
sub edx, ecx
mov eax, edx
shl eax, 15
sub eax, edx
cdqe
imul rax, rax, 274877907
mov rcx, rax
shr rcx, 63
sar rax, 38
add eax, ecx
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #595 | compute_stt_reward_q15 (THIS CAPSULE) domain: smart-tree | id: 4ce219fa55904c3a9d3722f6d2b692da | 1463333/200000 cyc/op | 1393901/400000 ns/op | 400000000/1393901 ops/us | 66 B .text (21 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |