Skip to content

Commit 7b2f725

Browse files
committed
Remove pub(crate) magnitude functions
1 parent 3e22df5 commit 7b2f725

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/bigint.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,6 @@ impl Arbitrary for BigInt {
155155
}
156156
}
157157

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-
170158
impl hash::Hash for BigInt {
171159
#[inline]
172160
fn hash<H: hash::Hasher>(&self, state: &mut H) {

src/bigrand.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::BigInt;
77
use crate::BigUint;
88
use crate::Sign::*;
99

10-
use crate::bigint::{into_magnitude, magnitude};
1110
use crate::biguint::biguint_from_vec;
1211

1312
use num_integer::Integer;
@@ -132,12 +131,12 @@ impl<R: Rng + ?Sized> RandBigInt for R {
132131
fn gen_bigint_range(&mut self, lbound: &BigInt, ubound: &BigInt) -> BigInt {
133132
assert!(*lbound < *ubound);
134133
if lbound.is_zero() {
135-
BigInt::from(self.gen_biguint_below(magnitude(&ubound)))
134+
BigInt::from(self.gen_biguint_below(ubound.magnitude()))
136135
} 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()))
138137
} else {
139138
let delta = ubound - lbound;
140-
lbound + BigInt::from(self.gen_biguint_below(magnitude(&delta)))
139+
lbound + BigInt::from(self.gen_biguint_below(delta.magnitude()))
141140
}
142141
}
143142
}
@@ -218,7 +217,7 @@ impl UniformSampler for UniformBigInt {
218217
let high = high_b.borrow();
219218
assert!(low < high);
220219
UniformBigInt {
221-
len: into_magnitude(high - low),
220+
len: (high - low).into_parts().1,
222221
base: low.clone(),
223222
}
224223
}

0 commit comments

Comments
 (0)