mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
factor::Factors: Rename new() to one()
This commit is contained in:
parent
f33ffc73eb
commit
71e1c52920
3 changed files with 4 additions and 4 deletions
|
@ -32,7 +32,7 @@ struct Factors {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Factors {
|
impl Factors {
|
||||||
fn new() -> Factors {
|
fn one() -> Factors {
|
||||||
Factors { f: BTreeMap::new() }
|
Factors { f: BTreeMap::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ impl fmt::Display for Factors {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn factor(mut n: u64) -> Factors {
|
fn factor(mut n: u64) -> Factors {
|
||||||
let mut factors = Factors::new();
|
let mut factors = Factors::one();
|
||||||
|
|
||||||
if n < 2 {
|
if n < 2 {
|
||||||
factors.push(n);
|
factors.push(n);
|
||||||
|
|
|
@ -55,7 +55,7 @@ fn _factor<A: Arithmetic>(num: u64) -> Factors {
|
||||||
_factor::<A>(n)
|
_factor::<A>(n)
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut factors = Factors::new();
|
let mut factors = Factors::one();
|
||||||
if num == 1 {
|
if num == 1 {
|
||||||
return factors;
|
return factors;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::Factors;
|
||||||
include!(concat!(env!("OUT_DIR"), "/prime_table.rs"));
|
include!(concat!(env!("OUT_DIR"), "/prime_table.rs"));
|
||||||
|
|
||||||
pub(crate) fn factor(mut num: u64) -> (Factors, u64) {
|
pub(crate) fn factor(mut num: u64) -> (Factors, u64) {
|
||||||
let mut factors = Factors::new();
|
let mut factors = Factors::one();
|
||||||
for &(prime, inv, ceil) in P_INVS_U64 {
|
for &(prime, inv, ceil) in P_INVS_U64 {
|
||||||
if num == 1 {
|
if num == 1 {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue