@@ -29,7 +29,7 @@ macro_rules! from_transmute_x86 {
2929/// Implements common traits on the specified vector `$name`, holding multiple `$lanes` of `$type`.
3030macro_rules! impl_vector {
3131 { $name: ident, $type: ty } => {
32- impl <const LANES : usize > $name<LANES > {
32+ impl <const LANES : usize > $name<LANES > where Self : crate :: LanesAtMost64 {
3333 /// Construct a SIMD vector by setting all lanes to the given value.
3434 pub const fn splat( value: $type) -> Self {
3535 Self ( [ value; LANES ] )
@@ -72,31 +72,31 @@ macro_rules! impl_vector {
7272 }
7373 }
7474
75- impl <const LANES : usize > Copy for $name<LANES > { }
75+ impl <const LANES : usize > Copy for $name<LANES > where Self : crate :: LanesAtMost64 { }
7676
77- impl <const LANES : usize > Clone for $name<LANES > {
77+ impl <const LANES : usize > Clone for $name<LANES > where Self : crate :: LanesAtMost64 {
7878 #[ inline]
7979 fn clone( & self ) -> Self {
8080 * self
8181 }
8282 }
8383
84- impl <const LANES : usize > Default for $name<LANES > {
84+ impl <const LANES : usize > Default for $name<LANES > where Self : crate :: LanesAtMost64 {
8585 #[ inline]
8686 fn default ( ) -> Self {
8787 Self :: splat( <$type>:: default ( ) )
8888 }
8989 }
9090
91- impl <const LANES : usize > PartialEq for $name<LANES > {
91+ impl <const LANES : usize > PartialEq for $name<LANES > where Self : crate :: LanesAtMost64 {
9292 #[ inline]
9393 fn eq( & self , other: & Self ) -> bool {
9494 // TODO use SIMD equality
9595 self . to_array( ) == other. to_array( )
9696 }
9797 }
9898
99- impl <const LANES : usize > PartialOrd for $name<LANES > {
99+ impl <const LANES : usize > PartialOrd for $name<LANES > where Self : crate :: LanesAtMost64 {
100100 #[ inline]
101101 fn partial_cmp( & self , other: & Self ) -> Option <core:: cmp:: Ordering > {
102102 // TODO use SIMD equalitya
@@ -105,44 +105,44 @@ macro_rules! impl_vector {
105105 }
106106
107107 // array references
108- impl <const LANES : usize > AsRef <[ $type; LANES ] > for $name<LANES > {
108+ impl <const LANES : usize > AsRef <[ $type; LANES ] > for $name<LANES > where Self : crate :: LanesAtMost64 {
109109 #[ inline]
110110 fn as_ref( & self ) -> & [ $type; LANES ] {
111111 & self . 0
112112 }
113113 }
114114
115- impl <const LANES : usize > AsMut <[ $type; LANES ] > for $name<LANES > {
115+ impl <const LANES : usize > AsMut <[ $type; LANES ] > for $name<LANES > where Self : crate :: LanesAtMost64 {
116116 #[ inline]
117117 fn as_mut( & mut self ) -> & mut [ $type; LANES ] {
118118 & mut self . 0
119119 }
120120 }
121121
122122 // slice references
123- impl <const LANES : usize > AsRef <[ $type] > for $name<LANES > {
123+ impl <const LANES : usize > AsRef <[ $type] > for $name<LANES > where Self : crate :: LanesAtMost64 {
124124 #[ inline]
125125 fn as_ref( & self ) -> & [ $type] {
126126 & self . 0
127127 }
128128 }
129129
130- impl <const LANES : usize > AsMut <[ $type] > for $name<LANES > {
130+ impl <const LANES : usize > AsMut <[ $type] > for $name<LANES > where Self : crate :: LanesAtMost64 {
131131 #[ inline]
132132 fn as_mut( & mut self ) -> & mut [ $type] {
133133 & mut self . 0
134134 }
135135 }
136136
137137 // vector/array conversion
138- impl <const LANES : usize > From <[ $type; LANES ] > for $name<LANES > {
138+ impl <const LANES : usize > From <[ $type; LANES ] > for $name<LANES > where Self : crate :: LanesAtMost64 {
139139 fn from( array: [ $type; LANES ] ) -> Self {
140140 Self ( array)
141141 }
142142 }
143143
144144 // splat
145- impl <const LANES : usize > From <$type> for $name<LANES > {
145+ impl <const LANES : usize > From <$type> for $name<LANES > where Self : crate :: LanesAtMost64 {
146146 #[ inline]
147147 fn from( value: $type) -> Self {
148148 Self :: splat( value)
@@ -158,17 +158,17 @@ macro_rules! impl_integer_vector {
158158 { $name: ident, $type: ty } => {
159159 impl_vector! { $name, $type }
160160
161- impl <const LANES : usize > Eq for $name<LANES > { }
161+ impl <const LANES : usize > Eq for $name<LANES > where Self : crate :: LanesAtMost64 { }
162162
163- impl <const LANES : usize > Ord for $name<LANES > {
163+ impl <const LANES : usize > Ord for $name<LANES > where Self : crate :: LanesAtMost64 {
164164 #[ inline]
165165 fn cmp( & self , other: & Self ) -> core:: cmp:: Ordering {
166166 // TODO use SIMD cmp
167167 self . to_array( ) . cmp( other. as_ref( ) )
168168 }
169169 }
170170
171- impl <const LANES : usize > core:: hash:: Hash for $name<LANES > {
171+ impl <const LANES : usize > core:: hash:: Hash for $name<LANES > where Self : crate :: LanesAtMost64 {
172172 #[ inline]
173173 fn hash<H >( & self , state: & mut H )
174174 where
@@ -187,7 +187,11 @@ macro_rules! impl_float_vector {
187187 { $name: ident, $type: ty, $bits_ty: ident } => {
188188 impl_vector! { $name, $type }
189189
190- impl <const LANES : usize > $name<LANES > {
190+ impl <const LANES : usize > $name<LANES >
191+ where
192+ Self : crate :: LanesAtMost64 ,
193+ crate :: $bits_ty<LANES >: crate :: LanesAtMost64 ,
194+ {
191195 /// Raw transmutation to an unsigned integer vector type with the
192196 /// same size and number of lanes.
193197 #[ inline]
0 commit comments