File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,19 @@ mod imp {
33
33
#[ lang = "sized" ]
34
34
pub trait Sized { }
35
35
36
- macro_rules! each_int {
36
+ macro_rules! each_unsigned_int {
37
37
( $mac: ident) => (
38
38
$mac!( u8 ) ;
39
39
$mac!( u16 ) ;
40
40
$mac!( u32 ) ;
41
41
$mac!( u64 ) ;
42
42
$mac!( usize ) ;
43
+ )
44
+ }
45
+
46
+ macro_rules! each_int {
47
+ ( $mac: ident) => (
48
+ each_unsigned_int!( $mac) ;
43
49
$mac!( i8 ) ;
44
50
$mac!( i16 ) ;
45
51
$mac!( i32 ) ;
@@ -128,6 +134,38 @@ mod imp {
128
134
}
129
135
each_int ! ( impl_bitor) ;
130
136
137
+ #[ lang = "neg" ]
138
+ pub trait Neg {
139
+ type Output ;
140
+ fn neg ( self ) -> Self :: Output ;
141
+ }
142
+
143
+ macro_rules! impl_neg {
144
+ ( $( $i: ident) * ) => ( $(
145
+ impl Neg for $i {
146
+ type Output = $i;
147
+ fn neg( self ) -> $i { -self }
148
+ }
149
+ ) * )
150
+ }
151
+ each_unsigned_int ! ( impl_neg) ;
152
+
153
+ #[ lang = "not" ]
154
+ pub trait Not {
155
+ type Output ;
156
+ fn not ( self ) -> Self :: Output ;
157
+ }
158
+
159
+ macro_rules! impl_not {
160
+ ( $( $i: ident) * ) => ( $(
161
+ impl Not for $i {
162
+ type Output = $i;
163
+ fn not( self ) -> $i { !self }
164
+ }
165
+ ) * )
166
+ }
167
+ each_int ! ( impl_not) ;
168
+
131
169
pub mod mem {
132
170
pub fn size_of_val < T > ( _: & T ) -> usize { 4 }
133
171
}
You can’t perform that action at this time.
0 commit comments