summaryrefslogtreecommitdiffstats
path: root/vendor/packed_simd_2/src/api/slice
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/packed_simd_2/src/api/slice/from_slice.rs28
-rw-r--r--vendor/packed_simd_2/src/api/slice/write_to_slice.rs35
2 files changed, 15 insertions, 48 deletions
diff --git a/vendor/packed_simd_2/src/api/slice/from_slice.rs b/vendor/packed_simd_2/src/api/slice/from_slice.rs
index 25082d1e6..50f3914f7 100644
--- a/vendor/packed_simd_2/src/api/slice/from_slice.rs
+++ b/vendor/packed_simd_2/src/api/slice/from_slice.rs
@@ -14,11 +14,7 @@ macro_rules! impl_slice_from_slice {
unsafe {
assert!(slice.len() >= $elem_count);
let target_ptr = slice.get_unchecked(0) as *const $elem_ty;
- assert_eq!(
- target_ptr
- .align_offset(crate::mem::align_of::<Self>()),
- 0
- );
+ assert_eq!(target_ptr.align_offset(crate::mem::align_of::<Self>()), 0);
Self::from_slice_aligned_unchecked(slice)
}
}
@@ -43,15 +39,10 @@ macro_rules! impl_slice_from_slice {
/// If `slice.len() < Self::lanes()` or `&slice[0]` is not aligned
/// to an `align_of::<Self>()` boundary, the behavior is undefined.
#[inline]
- pub unsafe fn from_slice_aligned_unchecked(
- slice: &[$elem_ty],
- ) -> Self {
+ pub unsafe fn from_slice_aligned_unchecked(slice: &[$elem_ty]) -> Self {
debug_assert!(slice.len() >= $elem_count);
let target_ptr = slice.get_unchecked(0) as *const $elem_ty;
- debug_assert_eq!(
- target_ptr.align_offset(crate::mem::align_of::<Self>()),
- 0
- );
+ debug_assert_eq!(target_ptr.align_offset(crate::mem::align_of::<Self>()), 0);
#[allow(clippy::cast_ptr_alignment)]
*(target_ptr as *const Self)
@@ -63,20 +54,13 @@ macro_rules! impl_slice_from_slice {
///
/// If `slice.len() < Self::lanes()` the behavior is undefined.
#[inline]
- pub unsafe fn from_slice_unaligned_unchecked(
- slice: &[$elem_ty],
- ) -> Self {
+ pub unsafe fn from_slice_unaligned_unchecked(slice: &[$elem_ty]) -> Self {
use crate::mem::size_of;
debug_assert!(slice.len() >= $elem_count);
- let target_ptr =
- slice.get_unchecked(0) as *const $elem_ty as *const u8;
+ let target_ptr = slice.get_unchecked(0) as *const $elem_ty as *const u8;
let mut x = Self::splat(0 as $elem_ty);
let self_ptr = &mut x as *mut Self as *mut u8;
- crate::ptr::copy_nonoverlapping(
- target_ptr,
- self_ptr,
- size_of::<Self>(),
- );
+ crate::ptr::copy_nonoverlapping(target_ptr, self_ptr, size_of::<Self>());
x
}
}
diff --git a/vendor/packed_simd_2/src/api/slice/write_to_slice.rs b/vendor/packed_simd_2/src/api/slice/write_to_slice.rs
index b634d98b9..dd04a2634 100644
--- a/vendor/packed_simd_2/src/api/slice/write_to_slice.rs
+++ b/vendor/packed_simd_2/src/api/slice/write_to_slice.rs
@@ -13,13 +13,8 @@ macro_rules! impl_slice_write_to_slice {
pub fn write_to_slice_aligned(self, slice: &mut [$elem_ty]) {
unsafe {
assert!(slice.len() >= $elem_count);
- let target_ptr =
- slice.get_unchecked_mut(0) as *mut $elem_ty;
- assert_eq!(
- target_ptr
- .align_offset(crate::mem::align_of::<Self>()),
- 0
- );
+ let target_ptr = slice.get_unchecked_mut(0) as *mut $elem_ty;
+ assert_eq!(target_ptr.align_offset(crate::mem::align_of::<Self>()), 0);
self.write_to_slice_aligned_unchecked(slice);
}
}
@@ -45,18 +40,13 @@ macro_rules! impl_slice_write_to_slice {
/// aligned to an `align_of::<Self>()` boundary, the behavior is
/// undefined.
#[inline]
- pub unsafe fn write_to_slice_aligned_unchecked(
- self, slice: &mut [$elem_ty],
- ) {
+ pub unsafe fn write_to_slice_aligned_unchecked(self, slice: &mut [$elem_ty]) {
debug_assert!(slice.len() >= $elem_count);
let target_ptr = slice.get_unchecked_mut(0) as *mut $elem_ty;
- debug_assert_eq!(
- target_ptr.align_offset(crate::mem::align_of::<Self>()),
- 0
- );
+ debug_assert_eq!(target_ptr.align_offset(crate::mem::align_of::<Self>()), 0);
- #[allow(clippy::cast_ptr_alignment)]
- #[allow(clippy::cast_ptr_alignment)]
+ #[allow(clippy::cast_ptr_alignment)]
+ #[allow(clippy::cast_ptr_alignment)]
#[allow(clippy::cast_ptr_alignment)]
#[allow(clippy::cast_ptr_alignment)]
*(target_ptr as *mut Self) = self;
@@ -68,18 +58,11 @@ macro_rules! impl_slice_write_to_slice {
///
/// If `slice.len() < Self::lanes()` the behavior is undefined.
#[inline]
- pub unsafe fn write_to_slice_unaligned_unchecked(
- self, slice: &mut [$elem_ty],
- ) {
+ pub unsafe fn write_to_slice_unaligned_unchecked(self, slice: &mut [$elem_ty]) {
debug_assert!(slice.len() >= $elem_count);
- let target_ptr =
- slice.get_unchecked_mut(0) as *mut $elem_ty as *mut u8;
+ let target_ptr = slice.get_unchecked_mut(0) as *mut $elem_ty as *mut u8;
let self_ptr = &self as *const Self as *const u8;
- crate::ptr::copy_nonoverlapping(
- self_ptr,
- target_ptr,
- crate::mem::size_of::<Self>(),
- );
+ crate::ptr::copy_nonoverlapping(self_ptr, target_ptr, crate::mem::size_of::<Self>());
}
}