@@ -72,23 +72,40 @@ macro_rules! builtin_implementation {
72
72
#[ inline] fn zero( ) -> Self { 0 }
73
73
}
74
74
75
- impl Abelian for $t {
76
- #[ inline] fn negate( self ) -> Self { -self }
77
- }
78
-
79
75
impl Multiply <Self > for $t {
80
76
type Output = Self ;
81
77
fn multiply( self , rhs: & Self ) -> Self { self * rhs}
82
78
}
83
79
} ;
84
80
}
85
81
82
+ macro_rules! builtin_abelian_implementation {
83
+ ( $t: ty) => {
84
+ impl Abelian for $t {
85
+ #[ inline] fn negate( self ) -> Self { -self }
86
+ }
87
+ } ;
88
+ }
89
+
86
90
builtin_implementation ! ( i8 ) ;
87
91
builtin_implementation ! ( i16 ) ;
88
92
builtin_implementation ! ( i32 ) ;
89
93
builtin_implementation ! ( i64 ) ;
90
94
builtin_implementation ! ( i128 ) ;
91
95
builtin_implementation ! ( isize ) ;
96
+ builtin_implementation ! ( u8 ) ;
97
+ builtin_implementation ! ( u16 ) ;
98
+ builtin_implementation ! ( u32 ) ;
99
+ builtin_implementation ! ( u64 ) ;
100
+ builtin_implementation ! ( u128 ) ;
101
+ builtin_implementation ! ( usize ) ;
102
+
103
+ builtin_abelian_implementation ! ( i8 ) ;
104
+ builtin_abelian_implementation ! ( i16 ) ;
105
+ builtin_abelian_implementation ! ( i32 ) ;
106
+ builtin_abelian_implementation ! ( i64 ) ;
107
+ builtin_abelian_implementation ! ( i128 ) ;
108
+ builtin_abelian_implementation ! ( isize ) ;
92
109
93
110
/// Implementations for wrapping signed integers, which have a different zero.
94
111
macro_rules! wrapping_implementation {
0 commit comments