diff --git a/reed-solomon-novelpoly/src/field/inc_afft.rs b/reed-solomon-novelpoly/src/field/inc_afft.rs index 7f7c555..ad877a7 100644 --- a/reed-solomon-novelpoly/src/field/inc_afft.rs +++ b/reed-solomon-novelpoly/src/field/inc_afft.rs @@ -89,7 +89,8 @@ fn b_is_one() { /// Inverse additive FFT in the "novel polynomial basis" /// -/// # Safety: See safety section of `AdditiveFFT::inverse_afft`. +/// # Safety +/// See safety section of `AdditiveFFT::inverse_afft`. pub unsafe fn inverse_afft(data: &mut [Additive], size: usize, index: usize) { unsafe { &AFFT }.inverse_afft(data, size, index) } @@ -101,7 +102,8 @@ pub fn inverse_afft_faster8(data: &mut [Additive], size: usize, index: usize) { /// Additive FFT in the "novel polynomial basis" /// -/// # Safety: See safety section of `AdditiveFFT::afft`. +/// # Safety +/// See safety section of `AdditiveFFT::afft`. pub unsafe fn afft(data: &mut [Additive], size: usize, index: usize) { unsafe { &AFFT }.afft(data, size, index) } @@ -597,7 +599,9 @@ mod afft_tests { let mut data_plain = gen_plain::(size); let mut data_faster8 = gen_faster8::(size); println!(">>>>"); - unsafe { &AFFT }.afft(&mut data_plain, size, index); + unsafe { + AFFT.afft(&mut data_plain, size, index); + } println!( r#" @@ -618,7 +622,9 @@ mod afft_tests { let mut data_plain = gen_plain::(size); let mut data_faster8 = gen_faster8::(size); println!(">>>>"); - unsafe { &AFFT }.afft(&mut data_plain, size, index); + unsafe { + AFFT.afft(&mut data_plain, size, index); + } println!( r#" @@ -627,6 +633,7 @@ mod afft_tests { "# ); unsafe { &AFFT }.afft_faster8(&mut data_faster8, size, index); + println!(">>>>"); assert_plain_eq_faster8(data_plain, data_faster8); } @@ -644,7 +651,9 @@ mod afft_tests { assert_plain_eq_faster8(&data_plain, &data_faster8); println!(">>>>"); - unsafe { &AFFT }.afft(&mut data_plain, size, index); + unsafe { + AFFT.afft(&mut data_plain, size, index); + } println!( r#" @@ -667,7 +676,9 @@ mod afft_tests { assert_plain_eq_faster8(&data_plain, &data_faster8); println!(">>>>"); - unsafe { &AFFT }.inverse_afft(&mut data_plain, size, index); + unsafe { + AFFT.inverse_afft(&mut data_plain, size, index); + } println!( r#" @@ -688,7 +699,9 @@ mod afft_tests { let mut data_plain = gen_plain::(size); let mut data_faster8 = gen_faster8::(size); println!(">>>>"); - unsafe { &AFFT }.inverse_afft(&mut data_plain, size, index); + unsafe { + AFFT.inverse_afft(&mut data_plain, size, index); + } println!( r#" diff --git a/reed-solomon-novelpoly/src/field/inc_encode.rs b/reed-solomon-novelpoly/src/field/inc_encode.rs index acc7b79..48335c7 100644 --- a/reed-solomon-novelpoly/src/field/inc_encode.rs +++ b/reed-solomon-novelpoly/src/field/inc_encode.rs @@ -7,7 +7,7 @@ pub fn encode_low(data: &[Additive], k: usize, codeword: &mut [Additive], n: usi encode_low_plain(data, k, codeword, n); } - #[cfg(not(target_feature = "avx"))] + #[cfg(not(all(target_feature = "avx", feature = "avx")))] encode_low_plain(data, k, codeword, n); } @@ -188,7 +188,7 @@ pub fn encode_sub(bytes: &[u8], n: usize, k: usize) -> Result> { } else { encode_sub_plain(bytes, n, k) } - #[cfg(not(target_feature = "avx"))] + #[cfg(not(all(target_feature = "avx", feature = "avx")))] encode_sub_plain(bytes, n, k) } diff --git a/reed-solomon-novelpoly/src/field/inc_log_mul.rs b/reed-solomon-novelpoly/src/field/inc_log_mul.rs index df53949..d5967ae 100644 --- a/reed-solomon-novelpoly/src/field/inc_log_mul.rs +++ b/reed-solomon-novelpoly/src/field/inc_log_mul.rs @@ -82,9 +82,9 @@ impl std::fmt::Display for Multiplier { /// Fast Walsh–Hadamard transform over modulo `ONEMASK` #[inline(always)] pub fn walsh(data: &mut [Multiplier], size: usize) { - #[cfg(all(target_feature = "avx", table_bootstrap_complete))] + #[cfg(all(target_feature = "avx", table_bootstrap_complete, feature = "avx"))] walsh_faster8(data, size); - #[cfg(not(all(target_feature = "avx", table_bootstrap_complete)))] + #[cfg(not(all(target_feature = "avx", table_bootstrap_complete, feature = "avx")))] walsh_plain(data, size); } diff --git a/reed-solomon-novelpoly/src/novel_poly_basis/mod.rs b/reed-solomon-novelpoly/src/novel_poly_basis/mod.rs index ba980b8..693ccba 100644 --- a/reed-solomon-novelpoly/src/novel_poly_basis/mod.rs +++ b/reed-solomon-novelpoly/src/novel_poly_basis/mod.rs @@ -66,7 +66,7 @@ impl CodeParams { { self.k >= (Additive8x::LANE << 1) && self.n % Additive8x::LANE == 0 } - #[cfg(not(target_feature = "avx"))] + #[cfg(not(all(target_feature = "avx", feature = "avx")))] false }