@@ -138,6 +138,32 @@ macro_rules! call_counting_args {
138
138
/// Implements common traits on the specified vector `$name`, holding multiple `$lanes` of `$type`.
139
139
macro_rules! base_vector_traits {
140
140
{ $name: path => [ $type: ty; $lanes: literal] } => {
141
+ impl Copy for $name { }
142
+
143
+ impl Clone for $name {
144
+ fn clone( & self ) -> Self {
145
+ * self
146
+ }
147
+ }
148
+
149
+ impl Default for $name {
150
+ fn default ( ) -> Self {
151
+ Self :: splat( <$type>:: default ( ) )
152
+ }
153
+ }
154
+
155
+ impl PartialEq for $name {
156
+ fn eq( & self , other: & Self ) -> bool {
157
+ AsRef :: <[ $type] >:: as_ref( self ) == AsRef :: <[ $type] >:: as_ref( other)
158
+ }
159
+ }
160
+
161
+ impl PartialOrd for $name {
162
+ fn partial_cmp( & self , other: & Self ) -> Option <core:: cmp:: Ordering > {
163
+ AsRef :: <[ $type] >:: as_ref( self ) . partial_cmp( AsRef :: <[ $type] >:: as_ref( other) )
164
+ }
165
+ }
166
+
141
167
// array references
142
168
impl AsRef <[ $type; $lanes] > for $name {
143
169
#[ inline]
@@ -196,7 +222,6 @@ macro_rules! define_vector {
196
222
{ def $( #[ $attr: meta] ) * | $name: ident | $( $itype: ty) * } => {
197
223
$( #[ $attr] ) *
198
224
#[ allow( non_camel_case_types) ]
199
- #[ derive( Copy , Clone , Default , PartialEq , PartialOrd ) ]
200
225
#[ repr( simd) ]
201
226
pub struct $name( $( $itype) ,* ) ;
202
227
} ;
@@ -233,7 +258,7 @@ macro_rules! define_mask_vector {
233
258
{ def $( #[ $attr: meta] ) * | $name: ident | $( $itype: ty) * } => {
234
259
$( #[ $attr] ) *
235
260
#[ allow( non_camel_case_types) ]
236
- #[ derive( Copy , Clone , Default , PartialEq , PartialOrd , Eq , Ord ) ]
261
+ #[ derive( Eq , Ord ) ]
237
262
#[ repr( simd) ]
238
263
pub struct $name( $( $itype) ,* ) ;
239
264
} ;
0 commit comments