@@ -95,12 +95,6 @@ depending on the target pointer size.
95
95
96
96
macro_rules! widening_impl {
97
97
( $SelfT: ty, $WideT: ty, $BITS: literal, unsigned) => {
98
- widening_impl!( $SelfT, $WideT, $BITS, "" ) ;
99
- } ;
100
- ( $SelfT: ty, $WideT: ty, $BITS: literal, signed) => {
101
- widening_impl!( $SelfT, $WideT, $BITS, "# //" ) ;
102
- } ;
103
- ( $SelfT: ty, $WideT: ty, $BITS: literal, $AdaptiveTestPrefix: literal) => {
104
98
/// Calculates the complete product `self * rhs` without the possibility to overflow.
105
99
///
106
100
/// This returns the low-order (wrapping) bits and the high-order (overflow) bits
@@ -154,7 +148,7 @@ macro_rules! widening_impl {
154
148
/// assert_eq!(5u32.carrying_mul(2, 10), (20, 0));
155
149
/// assert_eq!(1_000_000_000u32.carrying_mul(10, 0), (1410065408, 2));
156
150
/// assert_eq!(1_000_000_000u32.carrying_mul(10, 10), (1410065418, 2));
157
- #[ doc = concat!( $AdaptiveTestPrefix , "assert_eq!(" ,
151
+ #[ doc = concat!( "assert_eq!(" ,
158
152
stringify!( $SelfT) , "::MAX.carrying_mul(" , stringify!( $SelfT) , "::MAX, " , stringify!( $SelfT) , "::MAX), " ,
159
153
"(0, " , stringify!( $SelfT) , "::MAX));"
160
154
) ]
@@ -203,22 +197,19 @@ macro_rules! widening_impl {
203
197
impl i8 {
204
198
int_impl ! { i8 , i8 , u8 , 8 , 7 , -128 , 127 , 2 , "-0x7e" , "0xa" , "0x12" , "0x12" , "0x48" ,
205
199
"[0x12]" , "[0x12]" , "" , "" }
206
- widening_impl ! { i8 , i16 , 8 , signed }
207
200
}
208
201
209
202
#[ lang = "i16" ]
210
203
impl i16 {
211
204
int_impl ! { i16 , i16 , u16 , 16 , 15 , -32768 , 32767 , 4 , "-0x5ffd" , "0x3a" , "0x1234" , "0x3412" ,
212
205
"0x2c48" , "[0x34, 0x12]" , "[0x12, 0x34]" , "" , "" }
213
- widening_impl ! { i16 , i32 , 16 , signed }
214
206
}
215
207
216
208
#[ lang = "i32" ]
217
209
impl i32 {
218
210
int_impl ! { i32 , i32 , u32 , 32 , 31 , -2147483648 , 2147483647 , 8 , "0x10000b3" , "0xb301" ,
219
211
"0x12345678" , "0x78563412" , "0x1e6a2c48" , "[0x78, 0x56, 0x34, 0x12]" ,
220
212
"[0x12, 0x34, 0x56, 0x78]" , "" , "" }
221
- widening_impl ! { i32 , i64 , 32 , signed }
222
213
}
223
214
224
215
#[ lang = "i64" ]
@@ -227,7 +218,6 @@ impl i64 {
227
218
"0xaa00000000006e1" , "0x6e10aa" , "0x1234567890123456" , "0x5634129078563412" ,
228
219
"0x6a2c48091e6a2c48" , "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]" ,
229
220
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]" , "" , "" }
230
- widening_impl ! { i64 , i128 , 64 , signed }
231
221
}
232
222
233
223
#[ lang = "i128" ]
@@ -248,7 +238,6 @@ impl isize {
248
238
int_impl ! { isize , i16 , usize , 16 , 15 , -32768 , 32767 , 4 , "-0x5ffd" , "0x3a" , "0x1234" ,
249
239
"0x3412" , "0x2c48" , "[0x34, 0x12]" , "[0x12, 0x34]" ,
250
240
usize_isize_to_xe_bytes_doc!( ) , usize_isize_from_xe_bytes_doc!( ) }
251
- widening_impl ! { isize , i32 , 16 , signed }
252
241
}
253
242
254
243
#[ cfg( target_pointer_width = "32" ) ]
@@ -258,7 +247,6 @@ impl isize {
258
247
"0x12345678" , "0x78563412" , "0x1e6a2c48" , "[0x78, 0x56, 0x34, 0x12]" ,
259
248
"[0x12, 0x34, 0x56, 0x78]" ,
260
249
usize_isize_to_xe_bytes_doc!( ) , usize_isize_from_xe_bytes_doc!( ) }
261
- widening_impl ! { isize , i64 , 32 , signed }
262
250
}
263
251
264
252
#[ cfg( target_pointer_width = "64" ) ]
@@ -269,7 +257,6 @@ impl isize {
269
257
"0x6a2c48091e6a2c48" , "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]" ,
270
258
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]" ,
271
259
usize_isize_to_xe_bytes_doc!( ) , usize_isize_from_xe_bytes_doc!( ) }
272
- widening_impl ! { isize , i128 , 64 , signed }
273
260
}
274
261
275
262
/// If 6th bit set ascii is upper case.
0 commit comments