Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
alindima committed Dec 18, 2023
1 parent e6827f3 commit a3b5159
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
27 changes: 20 additions & 7 deletions reed-solomon-novelpoly/src/field/inc_afft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -597,7 +599,9 @@ mod afft_tests {
let mut data_plain = gen_plain::<SmallRng>(size);
let mut data_faster8 = gen_faster8::<SmallRng>(size);
println!(">>>>");
unsafe { &AFFT }.afft(&mut data_plain, size, index);
unsafe {
AFFT.afft(&mut data_plain, size, index);
}
println!(
r#"
Expand All @@ -618,7 +622,9 @@ mod afft_tests {
let mut data_plain = gen_plain::<SmallRng>(size);
let mut data_faster8 = gen_faster8::<SmallRng>(size);
println!(">>>>");
unsafe { &AFFT }.afft(&mut data_plain, size, index);
unsafe {
AFFT.afft(&mut data_plain, size, index);
}
println!(
r#"
Expand All @@ -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);
}
Expand All @@ -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#"
Expand All @@ -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#"
Expand All @@ -688,7 +699,9 @@ mod afft_tests {
let mut data_plain = gen_plain::<SmallRng>(size);
let mut data_faster8 = gen_faster8::<SmallRng>(size);
println!(">>>>");
unsafe { &AFFT }.inverse_afft(&mut data_plain, size, index);
unsafe {
AFFT.inverse_afft(&mut data_plain, size, index);
}
println!(
r#"
Expand Down
4 changes: 2 additions & 2 deletions reed-solomon-novelpoly/src/field/inc_encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn encode_sub(bytes: &[u8], n: usize, k: usize) -> Result<Vec<Additive>> {
} 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)
}

Expand Down
4 changes: 2 additions & 2 deletions reed-solomon-novelpoly/src/field/inc_log_mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion reed-solomon-novelpoly/src/novel_poly_basis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a3b5159

Please sign in to comment.