mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 23:17:46 +00:00
factor: Fix clippy warnings
This commit is contained in:
parent
f1d1cb80e4
commit
dcc22188ba
1 changed files with 2 additions and 11 deletions
|
@ -22,12 +22,6 @@ impl Factors {
|
||||||
Factors { f: BTreeMap::new() }
|
Factors { f: BTreeMap::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prime(p: u64) -> Factors {
|
|
||||||
let mut f = Factors::one();
|
|
||||||
f.push(p);
|
|
||||||
f
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add(&mut self, prime: u64, exp: u8) {
|
pub fn add(&mut self, prime: u64, exp: u8) {
|
||||||
debug_assert!(miller_rabin::is_prime(prime));
|
debug_assert!(miller_rabin::is_prime(prime));
|
||||||
debug_assert!(exp > 0);
|
debug_assert!(exp > 0);
|
||||||
|
@ -107,11 +101,8 @@ pub fn factor(mut n: u64) -> Factors {
|
||||||
|
|
||||||
let (factors, n) = table::factor(n, factors);
|
let (factors, n) = table::factor(n, factors);
|
||||||
|
|
||||||
if n < (1 << 32) {
|
// TODO: Optimise with 32 and 64b versions
|
||||||
_factor::<Montgomery>(n, factors)
|
_factor::<Montgomery>(n, factors)
|
||||||
} else {
|
|
||||||
_factor::<Montgomery>(n, factors)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue