1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
enum ExecPath { Avx2, Avx, Scalar, } fn select_path(cpu: &CpuInfo) -> ExecPath { if cpu.features.avx2 { ExecPath::Avx2 } else if cpu.features.avx { ExecPath::Avx } else { ExecPath::Scalar } }