mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +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 {
|
||||
fn new() -> Factors {
|
||||
fn one() -> Factors {
|
||||
Factors { f: BTreeMap::new() }
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ impl fmt::Display for Factors {
|
|||
}
|
||||
|
||||
fn factor(mut n: u64) -> Factors {
|
||||
let mut factors = Factors::new();
|
||||
let mut factors = Factors::one();
|
||||
|
||||
if n < 2 {
|
||||
factors.push(n);
|
||||
|
|
|
@ -55,7 +55,7 @@ fn _factor<A: Arithmetic>(num: u64) -> Factors {
|
|||
_factor::<A>(n)
|
||||
};
|
||||
|
||||
let mut factors = Factors::new();
|
||||
let mut factors = Factors::one();
|
||||
if num == 1 {
|
||||
return factors;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::Factors;
|
|||
include!(concat!(env!("OUT_DIR"), "/prime_table.rs"));
|
||||
|
||||
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 {
|
||||
if num == 1 {
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue