diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-02-13 00:49:51 -0500 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-02-13 00:49:51 -0500 |
| commit | 16904ebfc752af858141c7b72df00f6bb3ddc303 (patch) | |
| tree | fef3cd0ec6133e5143d476809ee64a8ccfbfb095 | |
| parent | 6362540f11aaa2f133c12cbb0b3ee903ea6f7f0e (diff) | |
| download | rust-16904ebfc752af858141c7b72df00f6bb3ddc303.tar.gz rust-16904ebfc752af858141c7b72df00f6bb3ddc303.zip | |
Add missing type bounds
| -rw-r--r-- | crates/core_simd/src/round.rs | 11 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_f32.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_f64.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_i128.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_i16.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_i32.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_i64.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_i8.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_isize.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_u128.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_u16.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_u32.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_u64.rs | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/vectors_usize.rs | 4 |
14 files changed, 49 insertions, 14 deletions
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<const LANES: usize> crate::$type<LANES> { + impl<const LANES: usize> crate::$type<LANES> + 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 @@ macro_rules! implement { pub fn ceil(self) -> Self { unsafe { crate::intrinsics::simd_ceil(self) } } + } + impl<const LANES: usize> crate::$type<LANES> + where + Self: crate::LanesAtMost64, + crate::$int_type<LANES>: 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<const LANES: usize>([f32; LANES]); +pub struct SimdF32<const LANES: usize>([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<const LANES: usize>([f64; LANES]); +pub struct SimdF64<const LANES: usize>([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<const LANES: usize>([i128; LANES]); +pub struct SimdI128<const LANES: usize>([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<const LANES: usize>([i16; LANES]); +pub struct SimdI16<const LANES: usize>([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<const LANES: usize>([i32; LANES]); +pub struct SimdI32<const LANES: usize>([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<const LANES: usize>([i64; LANES]); +pub struct SimdI64<const LANES: usize>([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<const LANES: usize>([i8; LANES]); +pub struct SimdI8<const LANES: usize>([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<const LANES: usize>([isize; LANES]); +pub struct SimdIsize<const LANES: usize>([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<const LANES: usize>([u128; LANES]); +pub struct SimdU128<const LANES: usize>([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<const LANES: usize>([u16; LANES]); +pub struct SimdU16<const LANES: usize>([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<const LANES: usize>([u32; LANES]); +pub struct SimdU32<const LANES: usize>([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<const LANES: usize>([u64; LANES]); +pub struct SimdU64<const LANES: usize>([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<const LANES: usize>([usize; LANES]); +pub struct SimdUsize<const LANES: usize>([usize; LANES]) +where + Self: crate::LanesAtMost64; impl_integer_vector! { SimdUsize, usize } |
