pub unsafe fn add_scaled_avx2<M: MontgomeryReduction32>(
x: &mut [MInt<M>],
y: &[MInt<M>],
a: &MInt<M>,
)Expand description
ยงSafety
AVX2 must be available, and x and y must have equal lengths.
Examples found in repository?
crates/competitive/src/num/mint/montgomery_dot_product.rs (line 52)
43 fn add_scaled_assign(x: &mut [MInt<Self>], y: &[MInt<Self>], a: &MInt<Self>) {
44 assert_eq!(x.len(), y.len());
45 #[cfg(target_arch = "x86_64")]
46 if x.len() >= 16 {
47 if x.len() >= 64 && avx512_enabled() && avx512_supported() {
48 unsafe { simd::add_scaled_avx512::<Self>(x, y, a) };
49 return;
50 }
51 if is_x86_feature_detected!("avx2") {
52 unsafe { simd::add_scaled_avx2::<Self>(x, y, a) };
53 return;
54 }
55 }
56 for (x, y) in x.iter_mut().zip(y) {
57 *x += *a * *y;
58 }
59 }