Skip to content

Commit 1c43928

Browse files
committed
Remove algorithms
1 parent 552418b commit 1c43928

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

src/biguint.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mod division;
1919
mod multiplication;
2020
mod subtraction;
2121

22-
mod algorithms;
2322
mod bits;
2423
mod convert;
2524
mod monty;
@@ -32,7 +31,6 @@ mod arbitrary;
3231
#[cfg(feature = "serde")]
3332
mod serde;
3433

35-
use self::algorithms::cmp_slice;
3634
pub(crate) use self::convert::to_str_radix_reversed;
3735

3836
/// A big unsigned integer type.
@@ -89,6 +87,17 @@ impl Ord for BigUint {
8987
}
9088
}
9189

90+
#[inline]
91+
fn cmp_slice(a: &[BigDigit], b: &[BigDigit]) -> Ordering {
92+
debug_assert!(a.last() != Some(&0));
93+
debug_assert!(b.last() != Some(&0));
94+
95+
match Ord::cmp(&a.len(), &b.len()) {
96+
Ordering::Equal => Iterator::cmp(a.iter().rev(), b.iter().rev()),
97+
other => other,
98+
}
99+
}
100+
92101
impl Default for BigUint {
93102
#[inline]
94103
fn default() -> BigUint {

src/biguint/algorithms.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/biguint/subtraction.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use super::algorithms::cmp_slice;
21
#[cfg(not(u64_digit))]
32
use super::u32_from_u128;
4-
use super::{biguint_from_vec, BigUint};
3+
use super::{biguint_from_vec, cmp_slice, BigUint};
54

65
use crate::big_digit::{self, BigDigit};
76
use crate::Sign::{self, Minus, NoSign, Plus};

0 commit comments

Comments
 (0)