teach clippy about IeeeFloat, and make all 'allow' into 'expect'

This commit is contained in:
Ralf Jung 2024-11-02 22:02:38 +01:00
parent 3253cc6785
commit c1b8d6611e
21 changed files with 28 additions and 39 deletions

View File

@ -1 +1 @@
arithmetic-side-effects-allowed = ["rustc_abi::Size"] arithmetic-side-effects-allowed = ["rustc_abi::Size", "rustc_apfloat::ieee::IeeeFloat"]

View File

@ -354,7 +354,7 @@ impl<'tcx> Stack {
self.borrows.get(idx).cloned() self.borrows.get(idx).cloned()
} }
#[allow(clippy::len_without_is_empty)] // Stacks are never empty #[expect(clippy::len_without_is_empty)] // Stacks are never empty
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.borrows.len() self.borrows.len()
} }

View File

@ -300,7 +300,6 @@ impl<'tcx> StoreBuffer {
interp_ok(()) interp_ok(())
} }
#[allow(clippy::if_same_then_else, clippy::needless_bool)]
/// Selects a valid store element in the buffer. /// Selects a valid store element in the buffer.
fn fetch_store<R: rand::Rng + ?Sized>( fn fetch_store<R: rand::Rng + ?Sized>(
&self, &self,

View File

@ -423,7 +423,7 @@ pub fn create_ecx<'tcx>(
/// Evaluates the entry function specified by `entry_id`. /// Evaluates the entry function specified by `entry_id`.
/// Returns `Some(return_code)` if program executed completed. /// Returns `Some(return_code)` if program executed completed.
/// Returns `None` if an evaluation error occurred. /// Returns `None` if an evaluation error occurred.
#[allow(clippy::needless_lifetimes)] #[expect(clippy::needless_lifetimes)]
pub fn eval_entry<'tcx>( pub fn eval_entry<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
entry_id: DefId, entry_id: DefId,

View File

@ -156,7 +156,7 @@ pub fn iter_exported_symbols<'tcx>(
for cnum in dependency_format.1.iter().enumerate().filter_map(|(num, &linkage)| { for cnum in dependency_format.1.iter().enumerate().filter_map(|(num, &linkage)| {
// We add 1 to the number because that's what rustc also does everywhere it // We add 1 to the number because that's what rustc also does everywhere it
// calls `CrateNum::new`... // calls `CrateNum::new`...
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
(linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1)) (linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1))
}) { }) {
// We can ignore `_export_info` here: we are a Rust crate, and everything is exported // We can ignore `_export_info` here: we are a Rust crate, and everything is exported

View File

@ -292,7 +292,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let b = this.read_scalar(b)?.to_f32()?; let b = this.read_scalar(b)?.to_f32()?;
let c = this.read_scalar(c)?.to_f32()?; let c = this.read_scalar(c)?.to_f32()?;
let fuse: bool = this.machine.rng.get_mut().gen(); let fuse: bool = this.machine.rng.get_mut().gen();
#[allow(clippy::arithmetic_side_effects)] // float ops don't overflow
let res = if fuse { let res = if fuse {
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11 // FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft() a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
@ -308,7 +307,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let b = this.read_scalar(b)?.to_f64()?; let b = this.read_scalar(b)?.to_f64()?;
let c = this.read_scalar(c)?.to_f64()?; let c = this.read_scalar(c)?.to_f64()?;
let fuse: bool = this.machine.rng.get_mut().gen(); let fuse: bool = this.machine.rng.get_mut().gen();
#[allow(clippy::arithmetic_side_effects)] // float ops don't overflow
let res = if fuse { let res = if fuse {
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11 // FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft() a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()

View File

@ -750,7 +750,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let val = if simd_element_to_bool(mask)? { let val = if simd_element_to_bool(mask)? {
// Size * u64 is implemented as always checked // Size * u64 is implemented as always checked
#[allow(clippy::arithmetic_side_effects)]
let ptr = ptr.wrapping_offset(dest.layout.size * i, this); let ptr = ptr.wrapping_offset(dest.layout.size * i, this);
let place = this.ptr_to_mplace(ptr, dest.layout); let place = this.ptr_to_mplace(ptr, dest.layout);
this.read_immediate(&place)? this.read_immediate(&place)?
@ -774,7 +773,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
if simd_element_to_bool(mask)? { if simd_element_to_bool(mask)? {
// Size * u64 is implemented as always checked // Size * u64 is implemented as always checked
#[allow(clippy::arithmetic_side_effects)]
let ptr = ptr.wrapping_offset(val.layout.size * i, this); let ptr = ptr.wrapping_offset(val.layout.size * i, this);
let place = this.ptr_to_mplace(ptr, val.layout); let place = this.ptr_to_mplace(ptr, val.layout);
this.write_immediate(*val, &place)? this.write_immediate(*val, &place)?
@ -831,7 +829,7 @@ fn simd_bitmask_index(idx: u32, vec_len: u32, endianness: Endian) -> u32 {
assert!(idx < vec_len); assert!(idx < vec_len);
match endianness { match endianness {
Endian::Little => idx, Endian::Little => idx,
#[allow(clippy::arithmetic_side_effects)] // idx < vec_len #[expect(clippy::arithmetic_side_effects)] // idx < vec_len
Endian::Big => vec_len - 1 - idx, // reverse order of bits Endian::Big => vec_len - 1 - idx, // reverse order of bits
} }
} }

View File

@ -21,7 +21,7 @@ use crate::*;
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct DynSym(Symbol); pub struct DynSym(Symbol);
#[allow(clippy::should_implement_trait)] #[expect(clippy::should_implement_trait)]
impl DynSym { impl DynSym {
pub fn from_str(name: &str) -> Self { pub fn from_str(name: &str) -> Self {
DynSym(Symbol::intern(name)) DynSym(Symbol::intern(name))
@ -648,7 +648,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
let val = this.read_scalar(val)?.to_i32()?; let val = this.read_scalar(val)?.to_i32()?;
let num = this.read_target_usize(num)?; let num = this.read_target_usize(num)?;
// The docs say val is "interpreted as unsigned char". // The docs say val is "interpreted as unsigned char".
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] #[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
let val = val as u8; let val = val as u8;
// C requires that this must always be a valid pointer (C18 §7.1.4). // C requires that this must always be a valid pointer (C18 §7.1.4).
@ -661,7 +661,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
.position(|&c| c == val) .position(|&c| c == val)
{ {
let idx = u64::try_from(idx).unwrap(); let idx = u64::try_from(idx).unwrap();
#[allow(clippy::arithmetic_side_effects)] // idx < num, so this never wraps #[expect(clippy::arithmetic_side_effects)] // idx < num, so this never wraps
let new_ptr = ptr.wrapping_offset(Size::from_bytes(num - idx - 1), this); let new_ptr = ptr.wrapping_offset(Size::from_bytes(num - idx - 1), this);
this.write_pointer(new_ptr, dest)?; this.write_pointer(new_ptr, dest)?;
} else { } else {
@ -675,7 +675,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
let val = this.read_scalar(val)?.to_i32()?; let val = this.read_scalar(val)?.to_i32()?;
let num = this.read_target_usize(num)?; let num = this.read_target_usize(num)?;
// The docs say val is "interpreted as unsigned char". // The docs say val is "interpreted as unsigned char".
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] #[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
let val = val as u8; let val = val as u8;
// C requires that this must always be a valid pointer (C18 §7.1.4). // C requires that this must always be a valid pointer (C18 §7.1.4).

View File

@ -188,7 +188,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
} }
/// The inverse of `io_error_to_errnum`. /// The inverse of `io_error_to_errnum`.
#[allow(clippy::needless_return)] #[expect(clippy::needless_return)]
fn try_errnum_to_io_error( fn try_errnum_to_io_error(
&self, &self,
errnum: Scalar, errnum: Scalar,

View File

@ -53,7 +53,7 @@ impl<'tcx> Default for TlsData<'tcx> {
impl<'tcx> TlsData<'tcx> { impl<'tcx> TlsData<'tcx> {
/// Generate a new TLS key with the given destructor. /// Generate a new TLS key with the given destructor.
/// `max_size` determines the integer size the key has to fit in. /// `max_size` determines the integer size the key has to fit in.
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
pub fn create_tls_key( pub fn create_tls_key(
&mut self, &mut self,
dtor: Option<ty::Instance<'tcx>>, dtor: Option<ty::Instance<'tcx>>,

View File

@ -385,7 +385,7 @@ pub struct DirTable {
} }
impl DirTable { impl DirTable {
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
fn insert_new(&mut self, read_dir: ReadDir) -> u64 { fn insert_new(&mut self, read_dir: ReadDir) -> u64 {
let id = self.next_id; let id = self.next_id;
self.next_id += 1; self.next_id += 1;

View File

@ -22,7 +22,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let flags = this.read_scalar(flags)?.to_i32()?; let flags = this.read_scalar(flags)?.to_i32()?;
// old_address must be a multiple of the page size // old_address must be a multiple of the page size
#[allow(clippy::arithmetic_side_effects)] // PAGE_SIZE is nonzero #[expect(clippy::arithmetic_side_effects)] // PAGE_SIZE is nonzero
if old_address.addr().bytes() % this.machine.page_size != 0 || new_size == 0 { if old_address.addr().bytes() % this.machine.page_size != 0 || new_size == 0 {
this.set_last_error(LibcError("EINVAL"))?; this.set_last_error(LibcError("EINVAL"))?;
return interp_ok(this.eval_libc("MAP_FAILED")); return interp_ok(this.eval_libc("MAP_FAILED"));

View File

@ -182,7 +182,7 @@ pub fn futex<'tcx>(
// before doing the syscall. // before doing the syscall.
this.atomic_fence(AtomicFenceOrd::SeqCst)?; this.atomic_fence(AtomicFenceOrd::SeqCst)?;
let mut n = 0; let mut n = 0;
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
for _ in 0..val { for _ in 0..val {
if this.futex_wake(addr_usize, bitset)? { if this.futex_wake(addr_usize, bitset)? {
n += 1; n += 1;

View File

@ -132,7 +132,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// addr must be a multiple of the page size, but apart from that munmap is just implemented // addr must be a multiple of the page size, but apart from that munmap is just implemented
// as a dealloc. // as a dealloc.
#[allow(clippy::arithmetic_side_effects)] // PAGE_SIZE is nonzero #[expect(clippy::arithmetic_side_effects)] // PAGE_SIZE is nonzero
if addr.addr().bytes() % this.machine.page_size != 0 { if addr.addr().bytes() % this.machine.page_size != 0 {
return this.set_last_error_and_return_i32(LibcError("EINVAL")); return this.set_last_error_and_return_i32(LibcError("EINVAL"));
} }

View File

@ -685,7 +685,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let id = rwlock_get_data(this, rwlock_op)?.id; let id = rwlock_get_data(this, rwlock_op)?.id;
#[allow(clippy::if_same_then_else)]
if this.rwlock_reader_unlock(id)? || this.rwlock_writer_unlock(id)? { if this.rwlock_reader_unlock(id)? || this.rwlock_writer_unlock(id)? {
interp_ok(()) interp_ok(())
} else { } else {

View File

@ -25,7 +25,7 @@ fn win_absolute<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<PathBuf>> {
} }
#[cfg(unix)] #[cfg(unix)]
#[allow(clippy::get_first, clippy::arithmetic_side_effects)] #[expect(clippy::get_first, clippy::arithmetic_side_effects)]
fn win_absolute<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<PathBuf>> { fn win_absolute<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<PathBuf>> {
// We are on Unix, so we need to implement parts of the logic ourselves. // We are on Unix, so we need to implement parts of the logic ourselves.
let bytes = path.as_os_str().as_encoded_bytes(); let bytes = path.as_os_str().as_encoded_bytes();

View File

@ -63,7 +63,7 @@ impl Handle {
let floor_log2 = variant_count.ilog2(); let floor_log2 = variant_count.ilog2();
// we need to add one for non powers of two to compensate for the difference // we need to add one for non powers of two to compensate for the difference
#[allow(clippy::arithmetic_side_effects)] // cannot overflow #[expect(clippy::arithmetic_side_effects)] // cannot overflow
if variant_count.is_power_of_two() { floor_log2 } else { floor_log2 + 1 } if variant_count.is_power_of_two() { floor_log2 } else { floor_log2 + 1 }
} }
@ -88,8 +88,7 @@ impl Handle {
// packs the data into the lower `data_size` bits // packs the data into the lower `data_size` bits
// and packs the discriminant right above the data // and packs the discriminant right above the data
#[allow(clippy::arithmetic_side_effects)] // cannot overflow discriminant << data_size | data
return discriminant << data_size | data;
} }
fn new(discriminant: u32, data: u32) -> Option<Self> { fn new(discriminant: u32, data: u32) -> Option<Self> {
@ -107,11 +106,10 @@ impl Handle {
let data_size = u32::BITS.strict_sub(disc_size); let data_size = u32::BITS.strict_sub(disc_size);
// the lower `data_size` bits of this mask are 1 // the lower `data_size` bits of this mask are 1
#[allow(clippy::arithmetic_side_effects)] // cannot overflow #[expect(clippy::arithmetic_side_effects)] // cannot overflow
let data_mask = 2u32.pow(data_size) - 1; let data_mask = 2u32.pow(data_size) - 1;
// the discriminant is stored right above the lower `data_size` bits // the discriminant is stored right above the lower `data_size` bits
#[allow(clippy::arithmetic_side_effects)] // cannot overflow
let discriminant = handle >> data_size; let discriminant = handle >> data_size;
// the data is stored in the lower `data_size` bits // the data is stored in the lower `data_size` bits
@ -123,7 +121,7 @@ impl Handle {
pub fn to_scalar(self, cx: &impl HasDataLayout) -> Scalar { pub fn to_scalar(self, cx: &impl HasDataLayout) -> Scalar {
// 64-bit handles are sign extended 32-bit handles // 64-bit handles are sign extended 32-bit handles
// see https://docs.microsoft.com/en-us/windows/win32/winprog64/interprocess-communication // see https://docs.microsoft.com/en-us/windows/win32/winprog64/interprocess-communication
#[allow(clippy::cast_possible_wrap)] // we want it to wrap #[expect(clippy::cast_possible_wrap)] // we want it to wrap
let signed_handle = self.to_packed() as i32; let signed_handle = self.to_packed() as i32;
Scalar::from_target_isize(signed_handle.into(), cx) Scalar::from_target_isize(signed_handle.into(), cx)
} }
@ -134,7 +132,7 @@ impl Handle {
) -> InterpResult<'tcx, Option<Self>> { ) -> InterpResult<'tcx, Option<Self>> {
let sign_extended_handle = handle.to_target_isize(cx)?; let sign_extended_handle = handle.to_target_isize(cx)?;
#[allow(clippy::cast_sign_loss)] // we want to lose the sign #[expect(clippy::cast_sign_loss)] // we want to lose the sign
let handle = if let Ok(signed_handle) = i32::try_from(sign_extended_handle) { let handle = if let Ok(signed_handle) = i32::try_from(sign_extended_handle) {
signed_handle as u32 signed_handle as u32
} else { } else {

View File

@ -136,7 +136,7 @@ fn affine_transform<'tcx>(
// This is a evaluated at compile time. Trait based conversion is not available. // This is a evaluated at compile time. Trait based conversion is not available.
/// See <https://www.corsix.org/content/galois-field-instructions-2021-cpus> for the /// See <https://www.corsix.org/content/galois-field-instructions-2021-cpus> for the
/// definition of `gf_inv` which was used for the creation of this table. /// definition of `gf_inv` which was used for the creation of this table.
#[allow(clippy::cast_possible_truncation)] #[expect(clippy::cast_possible_truncation)]
static TABLE: [u8; 256] = { static TABLE: [u8; 256] = {
let mut array = [0; 256]; let mut array = [0; 256];
@ -163,7 +163,7 @@ static TABLE: [u8; 256] = {
/// polynomial representation with the reduction polynomial x^8 + x^4 + x^3 + x + 1. /// polynomial representation with the reduction polynomial x^8 + x^4 + x^3 + x + 1.
/// See <https://www.corsix.org/content/galois-field-instructions-2021-cpus> for details. /// See <https://www.corsix.org/content/galois-field-instructions-2021-cpus> for details.
// This is a const function. Trait based conversion is not available. // This is a const function. Trait based conversion is not available.
#[allow(clippy::cast_possible_truncation)] #[expect(clippy::cast_possible_truncation)]
const fn gf2p8_mul(left: u8, right: u8) -> u8 { const fn gf2p8_mul(left: u8, right: u8) -> u8 {
// This implementation is based on the `gf2p8mul_byte` definition found inside the Intel intrinsics guide. // This implementation is based on the `gf2p8mul_byte` definition found inside the Intel intrinsics guide.
// See https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=gf2p8mul // See https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=gf2p8mul

View File

@ -397,7 +397,6 @@ enum FloatUnaryOp {
} }
/// Performs `which` scalar operation on `op` and returns the result. /// Performs `which` scalar operation on `op` and returns the result.
#[allow(clippy::arithmetic_side_effects)] // floating point operations without side effects
fn unary_op_f32<'tcx>( fn unary_op_f32<'tcx>(
this: &mut crate::MiriInterpCx<'tcx>, this: &mut crate::MiriInterpCx<'tcx>,
which: FloatUnaryOp, which: FloatUnaryOp,
@ -426,7 +425,7 @@ fn unary_op_f32<'tcx>(
} }
/// Disturbes a floating-point result by a relative error on the order of (-2^scale, 2^scale). /// Disturbes a floating-point result by a relative error on the order of (-2^scale, 2^scale).
#[allow(clippy::arithmetic_side_effects)] // floating point arithmetic cannot panic #[expect(clippy::arithmetic_side_effects)] // floating point arithmetic cannot panic
fn apply_random_float_error<F: rustc_apfloat::Float>( fn apply_random_float_error<F: rustc_apfloat::Float>(
this: &mut crate::MiriInterpCx<'_>, this: &mut crate::MiriInterpCx<'_>,
val: F, val: F,
@ -1000,7 +999,6 @@ fn mask_load<'tcx>(
let dest = this.project_index(&dest, i)?; let dest = this.project_index(&dest, i)?;
if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 {
#[allow(clippy::arithmetic_side_effects)] // `Size` arithmetic is checked
let ptr = ptr.wrapping_offset(dest.layout.size * i, &this.tcx); let ptr = ptr.wrapping_offset(dest.layout.size * i, &this.tcx);
// Unaligned copy, which is what we want. // Unaligned copy, which is what we want.
this.mem_copy(ptr, dest.ptr(), dest.layout.size, /*nonoverlapping*/ true)?; this.mem_copy(ptr, dest.ptr(), dest.layout.size, /*nonoverlapping*/ true)?;
@ -1036,7 +1034,6 @@ fn mask_store<'tcx>(
if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 {
// *Non-inbounds* pointer arithmetic to compute the destination. // *Non-inbounds* pointer arithmetic to compute the destination.
// (That's why we can't use a place projection.) // (That's why we can't use a place projection.)
#[allow(clippy::arithmetic_side_effects)] // `Size` arithmetic is checked
let ptr = ptr.wrapping_offset(value.layout.size * i, &this.tcx); let ptr = ptr.wrapping_offset(value.layout.size * i, &this.tcx);
// Deref the pointer *unaligned*, and do the copy. // Deref the pointer *unaligned*, and do the copy.
let dest = this.ptr_to_mplace_unaligned(ptr, value.layout); let dest = this.ptr_to_mplace_unaligned(ptr, value.layout);
@ -1135,7 +1132,7 @@ fn pmulhrsw<'tcx>(
// The result of this operation can overflow a signed 16-bit integer. // The result of this operation can overflow a signed 16-bit integer.
// When `left` and `right` are -0x8000, the result is 0x8000. // When `left` and `right` are -0x8000, the result is 0x8000.
#[allow(clippy::cast_possible_truncation)] #[expect(clippy::cast_possible_truncation)]
let res = res as i16; let res = res as i16;
this.write_scalar(Scalar::from_i16(res), &dest)?; this.write_scalar(Scalar::from_i16(res), &dest)?;

View File

@ -68,7 +68,7 @@ const USE_SIGNED: u8 = 2;
/// The mask may be negated if negation flags inside the immediate byte are set. /// The mask may be negated if negation flags inside the immediate byte are set.
/// ///
/// For more information, see the Intel Software Developer's Manual, Vol. 2b, Chapter 4.1. /// For more information, see the Intel Software Developer's Manual, Vol. 2b, Chapter 4.1.
#[allow(clippy::arithmetic_side_effects)] #[expect(clippy::arithmetic_side_effects)]
fn compare_strings<'tcx>( fn compare_strings<'tcx>(
this: &mut MiriInterpCx<'tcx>, this: &mut MiriInterpCx<'tcx>,
str1: &OpTy<'tcx>, str1: &OpTy<'tcx>,
@ -444,7 +444,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let crc = if bit_size == 64 { let crc = if bit_size == 64 {
// The 64-bit version will only consider the lower 32 bits, // The 64-bit version will only consider the lower 32 bits,
// while the upper 32 bits get discarded. // while the upper 32 bits get discarded.
#[allow(clippy::cast_possible_truncation)] #[expect(clippy::cast_possible_truncation)]
u128::from((left.to_u64()? as u32).reverse_bits()) u128::from((left.to_u64()? as u32).reverse_bits())
} else { } else {
u128::from(left.to_u32()?.reverse_bits()) u128::from(left.to_u32()?.reverse_bits())

View File

@ -181,7 +181,7 @@ unsafe fn schedule(v0: __m128i, v1: __m128i, v2: __m128i, v3: __m128i) -> __m128
} }
// we use unaligned loads with `__m128i` pointers // we use unaligned loads with `__m128i` pointers
#[allow(clippy::cast_ptr_alignment)] #[expect(clippy::cast_ptr_alignment)]
#[target_feature(enable = "sha,sse2,ssse3,sse4.1")] #[target_feature(enable = "sha,sse2,ssse3,sse4.1")]
unsafe fn digest_blocks(state: &mut [u32; 8], blocks: &[[u8; 64]]) { unsafe fn digest_blocks(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
#[allow(non_snake_case)] #[allow(non_snake_case)]