diff --git a/src/bin/calculate_pclmulqdq_artifacts.rs b/src/bin/calculate_pclmulqdq_artifacts.rs index a11e50c..9d4cda2 100644 --- a/src/bin/calculate_pclmulqdq_artifacts.rs +++ b/src/bin/calculate_pclmulqdq_artifacts.rs @@ -251,10 +251,10 @@ fn main() { } let polynomial = u64::from_str_radix( - &args[1].trim_start_matches("0x"), 16 + args[1].trim_start_matches("0x"), 16 ).expect("Failed to parse polynomial"); - for (_, &size) in KEY_SIZES.iter().enumerate() { + for &size in KEY_SIZES.iter() { println!("k_{} = 0x{:x}", size, generate_key(size as u64, polynomial)); } diff --git a/src/bin/crc_64_nvme_checksum.rs b/src/bin/crc_64_nvme_checksum.rs index ea50179..78343e5 100644 --- a/src/bin/crc_64_nvme_checksum.rs +++ b/src/bin/crc_64_nvme_checksum.rs @@ -22,7 +22,7 @@ fn calculate_crc_64_simd_from_file(file: &str) -> u64 { c.write(std::fs::read(file).unwrap().as_slice()); - return c.sum64(); + c.sum64() } fn calculate_crc_64_validate_from_file(file: &str) -> u64 { @@ -32,7 +32,7 @@ fn calculate_crc_64_validate_from_file(file: &str) -> u64 { digest.update(std::fs::read(file).unwrap().as_slice()); - return digest.finalize(); + digest.finalize() } fn calculate_crc_64_simd_from_string(input: &str) -> u64 { @@ -40,7 +40,7 @@ fn calculate_crc_64_simd_from_string(input: &str) -> u64 { c.write(input.as_bytes()); - return c.sum64(); + c.sum64() } fn calculate_crc_64_validate_from_string(input: &str) -> u64 { @@ -50,7 +50,7 @@ fn calculate_crc_64_validate_from_string(input: &str) -> u64 { digest.update(input.as_bytes()); - return digest.finalize(); + digest.finalize() } fn main() -> ExitCode { @@ -70,7 +70,7 @@ fn main() -> ExitCode { if "--file" == input_type { let file = &args[2]; - if false == fs::metadata(file).is_ok() { + if fs::metadata(file).is_err() { println!("Couldn't open file {}", file); return ExitCode::from(1); @@ -107,5 +107,5 @@ fn main() -> ExitCode { println!("An error occurred, likely due to bad command-line arguments."); - return ExitCode::from(1); + ExitCode::from(1) } \ No newline at end of file diff --git a/src/pclmulqdq/aarch64.rs b/src/pclmulqdq/aarch64.rs index fb7d2ae..6e97637 100644 --- a/src/pclmulqdq/aarch64.rs +++ b/src/pclmulqdq/aarch64.rs @@ -3,7 +3,6 @@ //! AArch64 implementation of the PCLMULQDQ-based CRC calculation. use std::arch::{aarch64::*, is_aarch64_feature_detected}; -use std::mem::transmute; use std::ops::BitXor; #[repr(transparent)] @@ -68,18 +67,18 @@ impl super::SimdExt for Simd { #[target_feature(enable = "neon")] unsafe fn fold_8(self, coeff: u64) -> Self { let [x0, x1] = self.into_poly64s(); - let h = Self::from_mul(transmute(coeff), x0); - let l = Self::new(0, transmute(x1)); + let h = Self::from_mul(coeff, x0); + let l = Self::new(0, x1); h ^ l } #[inline] #[target_feature(enable = "neon")] unsafe fn barrett(self, poly: u64, mu: u64) -> u64 { - let t1 = Self::from_mul(self.low_64(), transmute(mu)).low_64(); - let l = Self::from_mul(t1, transmute(poly)); - let reduced: u64 = transmute((self ^ l).high_64()); - let t1: u64 = transmute(t1); + let t1 = Self::from_mul(self.low_64(), mu).low_64(); + let l = Self::from_mul(t1, poly); + let reduced: u64 = (self ^ l).high_64(); + let t1: u64 = t1; reduced ^ t1 } }