Best Use & Engineering Application Guide

Engineering Category: RF Telemetry, Spectrum Mapping & Link Ranging

Best Use in Production: Converting radio channel indices, carrier frequencies, and RSSI link-budget attenuation using exact integer arithmetic for spectrum monitors.

When to Select This Capsule: Holds the #1 Equivalence Crown across 2 functionally identical implementations (fastest verified hardware _rdtsc). Sub-10-cycle hardware kernel (1331931/200000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.

Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(u32)->u8` — wire matching input pins via `snap_dag` or `snap_pipeline`.

Hardware _rdtsc: 1331931/200000 cycles/op
Latency: 63443/20000 ns/op
Throughput: 20000000/63443 ops/us
Compiled ELF64 .text: 526 B (156 x86_64 insns)
C64 64KB RAM Budget: 435/32768 (870 B source)
Ternary Vote: + (score 1) | Salience: 90/1
Pure-Rust Capsule Source Code (870 B)
pub fn freq_to_channel(freq: u32) -> u8 {
    match freq {
        2412 => 1,
        2417 => 2,
        2422 => 3,
        2427 => 4,
        2432 => 5,
        2437 => 6,
        2442 => 7,
        2447 => 8,
        2452 => 9,
        2457 => 10,
        2462 => 11,
        2467 => 12,
        2472 => 13,
        2484 => 14,
        5180 => 36,
        5200 => 40,
        5220 => 44,
        5240 => 48,
        5260 => 52,
        5280 => 56,
        5300 => 60,
        5320 => 64,
        5500 => 100,
        5520 => 104,
        5540 => 108,
        5560 => 112,
        5580 => 116,
        5600 => 120,
        5620 => 124,
        5640 => 128,
        5660 => 132,
        5680 => 136,
        5700 => 140,
        5720 => 144,
        5745 => 149,
        5765 => 153,
        5785 => 157,
        5805 => 161,
        5825 => 165,
        _ => 0,
    }
}
rustc -C opt-level=3 x86_64 Disassembly (526 B .text / 156 insns)
freq_to_channel:
    xor    eax, eax
    cmp    edi, 5299
    jg    .LBB7_13
    cmp    edi, 5179
    jg    .LBB7_4
    add    edi, -2412
    cmp    edi, 72
    ja    .LBB7_76
    lea    rcx, [rip + .LJTI7_0]
    movsxd    rdx, dword ptr [rcx + 4*rdi]
    add    rdx, rcx
    jmp    rdx
.LBB7_47:
    mov    al, 1
    ret
.LBB7_13:
    cmp    edi, 5639
    jle    .LBB7_14
    cmp    edi, 5744
    jg    .LBB7_39
    cmp    edi, 5679
    jle    .LBB7_32
    cmp    edi, 5680
    je    .LBB7_71
    cmp    edi, 5700
    je    .LBB7_72
    cmp    edi, 5720
    jne    .LBB7_76
    mov    al, -112
    ret
.LBB7_14:
    cmp    edi, 5539
    jle    .LBB7_15
    cmp    edi, 5579
    jle    .LBB7_23
    cmp    edi, 5580
    je    .LBB7_68
    cmp    edi, 5600
    je    .LBB7_69
    cmp    edi, 5620
    jne    .LBB7_76
    mov    al, 124
    ret
.LBB7_4:
    cmp    edi, 5239
    jg    .LBB7_9
    cmp    edi, 5180
    je    .LBB7_61
    cmp    edi, 5200
    je    .LBB7_62
    cmp    edi, 5220
    jne    .LBB7_76
    mov    al, 44
    ret
.LBB7_39:
    cmp    edi, 5784
    jle    .LBB7_40
    cmp    edi, 5785
    je    .LBB7_74
    cmp    edi, 5805
    je    .LBB7_75
    cmp    edi, 5825
    jne    .LBB7_76
    mov    al, -91
    ret
.LBB7_15:
    cmp    edi, 5499
    jg    .LBB7_19
    cmp    edi, 5300
    je    .LBB7_65
    cmp    edi, 5320
    jne    .LBB7_76
    mov    al, 64
    ret
.LBB7_9:
    cmp    edi, 5240
    je    .LBB7_63
    cmp    edi, 5260
    je    .LBB7_64
    cmp    edi, 5280
    jne    .LBB7_76
    mov    al, 56
    ret
.LBB7_19:
    cmp    edi, 5500
    je    .LBB7_66
    cmp    edi, 5520
    jne    .LBB7_76
    mov    al, 104
    ret
.LBB7_23:
    cmp    edi, 5540
    je    .LBB7_67
    cmp    edi, 5560
    jne    .LBB7_76
    mov    al, 112
    ret
.LBB7_32:
    cmp    edi, 5640
    je    .LBB7_70
    cmp    edi, 5660
    jne    .LBB7_76
    mov    al, -124
    ret
.LBB7_40:
    cmp    edi, 5745
    je    .LBB7_73
    cmp    edi, 5765
    jne    .LBB7_76
    mov    al, -103
    ret
.LBB7_55:
    mov    al, 9
    ret
.LBB7_60:
    mov    al, 14
    ret
.LBB7_53:
    mov    al, 7
    ret
.LBB7_49:
    mov    al, 3
    ret
.LBB7_52:
    mov    al, 6
    ret
.LBB7_48:
    mov    al, 2
    ret
.LBB7_51:
    mov    al, 5
    ret
.LBB7_50:
    mov    al, 4
    ret
.LBB7_58:
    mov    al, 12
    ret
.LBB7_59:
    mov    al, 13
    ret
.LBB7_54:
    mov    al, 8
    ret
.LBB7_57:
    mov    al, 11
    ret
.LBB7_56:
    mov    al, 10
    ret
.LBB7_62:
    mov    al, 40
    ret
.LBB7_64:
    mov    al, 52
    ret
.LBB7_61:
    mov    al, 36
    ret
.LBB7_63:
    mov    al, 48
    ret
.LBB7_65:
    mov    al, 60
    ret
.LBB7_66:
    mov    al, 100
    ret
.LBB7_67:
    mov    al, 108
    ret
.LBB7_69:
    mov    al, 120
    ret
.LBB7_70:
    mov    al, -128
    ret
.LBB7_73:
    mov    al, -107
    ret
.LBB7_72:
    mov    al, -116
    ret
.LBB7_75:
    mov    al, -95
.LBB7_76:
    ret
.LBB7_68:
    mov    al, 116
    ret
.LBB7_71:
    mov    al, -120
    ret
.LBB7_74:
    mov    al, -99
    ret

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

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#470freq_to_channel (THIS CAPSULE)
domain: WiFAKE-x86_64 | id: a701013cf4397ffc610b558d271a43d7
1331931/200000 cyc/op63443/20000 ns/op20000000/63443 ops/us526 B .text (156 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz
#478freq_to_channel
domain: smart-tree | id: 7ba23b7624912a945a913dd1ec284f3a
669763/100000 cyc/op319039/100000 ns/op100000000/319039 ops/us526 B .text (156 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz