diff --git a/crates/core_simd/src/round.rs b/crates/core_simd/src/round.rs index d77bc4e8fa7..ee232e2b222 100644 --- a/crates/core_simd/src/round.rs +++ b/crates/core_simd/src/round.rs @@ -2,7 +2,10 @@ macro_rules! implement { { $type:ident, $int_type:ident } => { - impl crate::$type { + impl crate::$type + where + Self: crate::LanesAtMost64, + { /// Returns the largest integer less than or equal to each lane. #[must_use = "method returns a new vector and does not mutate the original value"] #[inline] @@ -16,7 +19,13 @@ pub fn floor(self) -> Self { pub fn ceil(self) -> Self { unsafe { crate::intrinsics::simd_ceil(self) } } + } + impl crate::$type + where + Self: crate::LanesAtMost64, + crate::$int_type: crate::LanesAtMost64, + { /// Rounds toward zero and converts to the same-width integer type, assuming that /// the value is finite and fits in that type. /// diff --git a/crates/core_simd/src/vectors_f32.rs b/crates/core_simd/src/vectors_f32.rs index 0b5d8c6ec49..5bb8f3a1c34 100644 --- a/crates/core_simd/src/vectors_f32.rs +++ b/crates/core_simd/src/vectors_f32.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `f32` values. #[repr(simd)] -pub struct SimdF32([f32; LANES]); +pub struct SimdF32([f32; LANES]) +where + Self: crate::LanesAtMost64; impl_float_vector! { SimdF32, f32, SimdU32 } diff --git a/crates/core_simd/src/vectors_f64.rs b/crates/core_simd/src/vectors_f64.rs index 307f8a4acac..c0dca6a52ac 100644 --- a/crates/core_simd/src/vectors_f64.rs +++ b/crates/core_simd/src/vectors_f64.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `f64` values. #[repr(simd)] -pub struct SimdF64([f64; LANES]); +pub struct SimdF64([f64; LANES]) +where + Self: crate::LanesAtMost64; impl_float_vector! { SimdF64, f64, SimdU64 } diff --git a/crates/core_simd/src/vectors_i128.rs b/crates/core_simd/src/vectors_i128.rs index 16e6162be55..568fa81da80 100644 --- a/crates/core_simd/src/vectors_i128.rs +++ b/crates/core_simd/src/vectors_i128.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `i128` values. #[repr(simd)] -pub struct SimdI128([i128; LANES]); +pub struct SimdI128([i128; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdI128, i128 } diff --git a/crates/core_simd/src/vectors_i16.rs b/crates/core_simd/src/vectors_i16.rs index 08cc4af2a5e..d77e593a2ed 100644 --- a/crates/core_simd/src/vectors_i16.rs +++ b/crates/core_simd/src/vectors_i16.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `i16` values. #[repr(simd)] -pub struct SimdI16([i16; LANES]); +pub struct SimdI16([i16; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdI16, i16 } diff --git a/crates/core_simd/src/vectors_i32.rs b/crates/core_simd/src/vectors_i32.rs index 116f2abaeee..0a89eeda3b2 100644 --- a/crates/core_simd/src/vectors_i32.rs +++ b/crates/core_simd/src/vectors_i32.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `i32` values. #[repr(simd)] -pub struct SimdI32([i32; LANES]); +pub struct SimdI32([i32; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdI32, i32 } diff --git a/crates/core_simd/src/vectors_i64.rs b/crates/core_simd/src/vectors_i64.rs index 6a1e2094179..017140654a5 100644 --- a/crates/core_simd/src/vectors_i64.rs +++ b/crates/core_simd/src/vectors_i64.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `i64` values. #[repr(simd)] -pub struct SimdI64([i64; LANES]); +pub struct SimdI64([i64; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdI64, i64 } diff --git a/crates/core_simd/src/vectors_i8.rs b/crates/core_simd/src/vectors_i8.rs index 0ac5ba9efee..e21126533b8 100644 --- a/crates/core_simd/src/vectors_i8.rs +++ b/crates/core_simd/src/vectors_i8.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `i8` values. #[repr(simd)] -pub struct SimdI8([i8; LANES]); +pub struct SimdI8([i8; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdI8, i8 } diff --git a/crates/core_simd/src/vectors_isize.rs b/crates/core_simd/src/vectors_isize.rs index 6856f305092..ee23dfe7d86 100644 --- a/crates/core_simd/src/vectors_isize.rs +++ b/crates/core_simd/src/vectors_isize.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `isize` values. #[repr(simd)] -pub struct SimdIsize([isize; LANES]); +pub struct SimdIsize([isize; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdIsize, isize } diff --git a/crates/core_simd/src/vectors_u128.rs b/crates/core_simd/src/vectors_u128.rs index 522404f133e..7931b9e088f 100644 --- a/crates/core_simd/src/vectors_u128.rs +++ b/crates/core_simd/src/vectors_u128.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `u128` values. #[repr(simd)] -pub struct SimdU128([u128; LANES]); +pub struct SimdU128([u128; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdU128, u128 } diff --git a/crates/core_simd/src/vectors_u16.rs b/crates/core_simd/src/vectors_u16.rs index efe7dea58dc..91c0e616808 100644 --- a/crates/core_simd/src/vectors_u16.rs +++ b/crates/core_simd/src/vectors_u16.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `u16` values. #[repr(simd)] -pub struct SimdU16([u16; LANES]); +pub struct SimdU16([u16; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdU16, u16 } diff --git a/crates/core_simd/src/vectors_u32.rs b/crates/core_simd/src/vectors_u32.rs index a6cef5baeb7..b0400b5ba3a 100644 --- a/crates/core_simd/src/vectors_u32.rs +++ b/crates/core_simd/src/vectors_u32.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `u32` values. #[repr(simd)] -pub struct SimdU32([u32; LANES]); +pub struct SimdU32([u32; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdU32, u32 } diff --git a/crates/core_simd/src/vectors_u64.rs b/crates/core_simd/src/vectors_u64.rs index 3982e30f570..0f3712241fe 100644 --- a/crates/core_simd/src/vectors_u64.rs +++ b/crates/core_simd/src/vectors_u64.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `u64` values. #[repr(simd)] -pub struct SimdU64([u64; LANES]); +pub struct SimdU64([u64; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdU64, u64 } diff --git a/crates/core_simd/src/vectors_usize.rs b/crates/core_simd/src/vectors_usize.rs index c882898f9fb..ea089aeb9d3 100644 --- a/crates/core_simd/src/vectors_usize.rs +++ b/crates/core_simd/src/vectors_usize.rs @@ -2,7 +2,9 @@ /// A SIMD vector of containing `LANES` `usize` values. #[repr(simd)] -pub struct SimdUsize([usize; LANES]); +pub struct SimdUsize([usize; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdUsize, usize }