Skip to main content

simd_backend

Function simd_backend 

Source
pub fn simd_backend() -> SimdBackend
Examples found in repository?
crates/competitive/src/math/number_theoretic_transform.rs (line 256)
250fn ntt<M>(a: &mut [MInt<M>])
251where
252    M: Montgomery32NttModulus,
253{
254    #[cfg(target_arch = "x86_64")]
255    {
256        match simd_backend() {
257            SimdBackend::Avx512 => unsafe { ntt_simd::ntt_avx512::<M>(a) },
258            SimdBackend::Avx2 => unsafe { ntt_simd::ntt_avx2::<M>(a) },
259            SimdBackend::Scalar => ntt_scalar(a),
260        }
261    }
262    #[cfg(not(target_arch = "x86_64"))]
263    {
264        ntt_scalar(a);
265    }
266}
267
268fn intt<M>(a: &mut [MInt<M>])
269where
270    M: Montgomery32NttModulus,
271{
272    #[cfg(target_arch = "x86_64")]
273    {
274        match simd_backend() {
275            SimdBackend::Avx512 => unsafe { ntt_simd::intt_avx512::<M>(a) },
276            SimdBackend::Avx2 => unsafe { ntt_simd::intt_avx2::<M>(a) },
277            SimdBackend::Scalar => intt_scalar(a),
278        }
279    }
280    #[cfg(not(target_arch = "x86_64"))]
281    {
282        intt_scalar(a);
283    }
284}