File tree Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -155,18 +155,6 @@ impl Arbitrary for BigInt {
155
155
}
156
156
}
157
157
158
- /// Return the magnitude of a `BigInt`.
159
- #[ cfg( feature = "rand" ) ]
160
- pub ( crate ) fn magnitude ( i : & BigInt ) -> & BigUint {
161
- & i. data
162
- }
163
-
164
- /// Return the owned magnitude of a `BigInt`.
165
- #[ cfg( feature = "rand" ) ]
166
- pub ( crate ) fn into_magnitude ( i : BigInt ) -> BigUint {
167
- i. data
168
- }
169
-
170
158
impl hash:: Hash for BigInt {
171
159
#[ inline]
172
160
fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ use crate::BigInt;
7
7
use crate :: BigUint ;
8
8
use crate :: Sign :: * ;
9
9
10
- use crate :: bigint:: { into_magnitude, magnitude} ;
11
10
use crate :: biguint:: biguint_from_vec;
12
11
13
12
use num_integer:: Integer ;
@@ -132,12 +131,12 @@ impl<R: Rng + ?Sized> RandBigInt for R {
132
131
fn gen_bigint_range ( & mut self , lbound : & BigInt , ubound : & BigInt ) -> BigInt {
133
132
assert ! ( * lbound < * ubound) ;
134
133
if lbound. is_zero ( ) {
135
- BigInt :: from ( self . gen_biguint_below ( magnitude ( & ubound ) ) )
134
+ BigInt :: from ( self . gen_biguint_below ( ubound . magnitude ( ) ) )
136
135
} else if ubound. is_zero ( ) {
137
- lbound + BigInt :: from ( self . gen_biguint_below ( magnitude ( & lbound ) ) )
136
+ lbound + BigInt :: from ( self . gen_biguint_below ( lbound . magnitude ( ) ) )
138
137
} else {
139
138
let delta = ubound - lbound;
140
- lbound + BigInt :: from ( self . gen_biguint_below ( magnitude ( & delta ) ) )
139
+ lbound + BigInt :: from ( self . gen_biguint_below ( delta . magnitude ( ) ) )
141
140
}
142
141
}
143
142
}
@@ -218,7 +217,7 @@ impl UniformSampler for UniformBigInt {
218
217
let high = high_b. borrow ( ) ;
219
218
assert ! ( low < high) ;
220
219
UniformBigInt {
221
- len : into_magnitude ( high - low) ,
220
+ len : ( high - low) . into_parts ( ) . 1 ,
222
221
base : low. clone ( ) ,
223
222
}
224
223
}
You can’t perform that action at this time.
0 commit comments