Skip to content

Commit 16904eb

Browse files
committed
Add missing type bounds
1 parent 6362540 commit 16904eb

14 files changed

+49
-14
lines changed

crates/core_simd/src/round.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ macro_rules! implement {
22
{
33
$type:ident, $int_type:ident
44
} => {
5-
impl<const LANES: usize> crate::$type<LANES> {
5+
impl<const LANES: usize> crate::$type<LANES>
6+
where
7+
Self: crate::LanesAtMost64,
8+
{
69
/// Returns the largest integer less than or equal to each lane.
710
#[must_use = "method returns a new vector and does not mutate the original value"]
811
#[inline]
@@ -16,7 +19,13 @@ macro_rules! implement {
1619
pub fn ceil(self) -> Self {
1720
unsafe { crate::intrinsics::simd_ceil(self) }
1821
}
22+
}
1923

24+
impl<const LANES: usize> crate::$type<LANES>
25+
where
26+
Self: crate::LanesAtMost64,
27+
crate::$int_type<LANES>: crate::LanesAtMost64,
28+
{
2029
/// Rounds toward zero and converts to the same-width integer type, assuming that
2130
/// the value is finite and fits in that type.
2231
///

crates/core_simd/src/vectors_f32.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `f32` values.
44
#[repr(simd)]
5-
pub struct SimdF32<const LANES: usize>([f32; LANES]);
5+
pub struct SimdF32<const LANES: usize>([f32; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_float_vector! { SimdF32, f32, SimdU32 }
810

crates/core_simd/src/vectors_f64.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `f64` values.
44
#[repr(simd)]
5-
pub struct SimdF64<const LANES: usize>([f64; LANES]);
5+
pub struct SimdF64<const LANES: usize>([f64; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_float_vector! { SimdF64, f64, SimdU64 }
810

crates/core_simd/src/vectors_i128.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `i128` values.
44
#[repr(simd)]
5-
pub struct SimdI128<const LANES: usize>([i128; LANES]);
5+
pub struct SimdI128<const LANES: usize>([i128; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdI128, i128 }
810

crates/core_simd/src/vectors_i16.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `i16` values.
44
#[repr(simd)]
5-
pub struct SimdI16<const LANES: usize>([i16; LANES]);
5+
pub struct SimdI16<const LANES: usize>([i16; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdI16, i16 }
810

crates/core_simd/src/vectors_i32.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `i32` values.
44
#[repr(simd)]
5-
pub struct SimdI32<const LANES: usize>([i32; LANES]);
5+
pub struct SimdI32<const LANES: usize>([i32; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdI32, i32 }
810

crates/core_simd/src/vectors_i64.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `i64` values.
44
#[repr(simd)]
5-
pub struct SimdI64<const LANES: usize>([i64; LANES]);
5+
pub struct SimdI64<const LANES: usize>([i64; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdI64, i64 }
810

crates/core_simd/src/vectors_i8.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `i8` values.
44
#[repr(simd)]
5-
pub struct SimdI8<const LANES: usize>([i8; LANES]);
5+
pub struct SimdI8<const LANES: usize>([i8; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdI8, i8 }
810

crates/core_simd/src/vectors_isize.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `isize` values.
44
#[repr(simd)]
5-
pub struct SimdIsize<const LANES: usize>([isize; LANES]);
5+
pub struct SimdIsize<const LANES: usize>([isize; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdIsize, isize }
810

crates/core_simd/src/vectors_u128.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/// A SIMD vector of containing `LANES` `u128` values.
44
#[repr(simd)]
5-
pub struct SimdU128<const LANES: usize>([u128; LANES]);
5+
pub struct SimdU128<const LANES: usize>([u128; LANES])
6+
where
7+
Self: crate::LanesAtMost64;
68

79
impl_integer_vector! { SimdU128, u128 }
810

0 commit comments

Comments
 (0)