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 (1533893/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(i32,u32)->u32` — wire matching input pins via `snap_dag` or `snap_pipeline`.
.text: 79 B (20 x86_64 insns)290 B)pub fn speed_of_sound_mm_per_s(temp_deci_c: i32, humidity_pct: u32) -> u32 {
let clamped_t = temp_deci_c.clamp(-200, 600);
let clamped_rh = humidity_pct.min(100) as i32;
let c_mm_s = 331_300 + (606 * clamped_t) / 10 + 12 * clamped_rh;
c_mm_s.clamp(310_000, 370_000) as u32
}
rustc -C opt-level=3 x86_64 Disassembly (79 B .text / 20 insns)speed_of_sound_mm_per_s:
cmp edi, -199
mov eax, -200
cmovge eax, edi
cmp eax, 600
mov ecx, 600
cmovl ecx, eax
cmp esi, 100
mov eax, 100
cmovb eax, esi
imul ecx, ecx, 606
movsxd rcx, ecx
imul rcx, rcx, 1717986919
mov rdx, rcx
shr rdx, 63
sar rcx, 34
add ecx, edx
lea eax, [rax + 2*rax]
lea eax, [rcx + 4*rax]
add eax, 331300
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #570 | speed_of_sound_mm_per_s (THIS CAPSULE) domain: smart-tree | id: 247538d5a4d7595467ae5ae89897ff0b | 1533893/200000 cyc/op | 182657/50000 ns/op | 50000000/182657 ops/us | 79 B .text (20 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |