Knight
b0588e482e
uucore: add disp_err macro
2020-11-08 19:56:50 -06:00
Shiroy
713770c9ae
Add missing lib.name for uucore
...
Fix build on Linux
2020-11-08 19:56:50 -06:00
Arcterus
a149efe45a
uucore: don't follow symlinks when examining them ( fixes #799 )
2020-11-08 19:56:49 -06:00
Michael Gehring
512a6a3201
expand, unexpand: fix build on stable
2020-11-08 19:56:49 -06:00
Michael Gehring
0a3a2ca935
Fix clippy warnings
2020-11-08 19:56:49 -06:00
Michael Gehring
ce733b38a9
Fix arm build
...
Fixes #719
2020-11-08 19:56:49 -06:00
Joseph Crail
bde309a29f
Remove trait shim needed before Path stabilized
...
Now that Path has stabilized in Rust 1.5, I removed the UUPathExt trait
needed to support stable, beta, and nightly.
2020-11-08 19:56:49 -06:00
Joseph Crail
0678332a1f
Add macro to properly find program name.
2020-11-08 19:56:49 -06:00
Joseph Crail
b8ee12f703
More import fixes for Windows.
2020-11-08 19:56:49 -06:00
Joseph Crail
3863842fae
Fix errors with bools represented as ints.
2020-11-08 19:56:49 -06:00
Joseph Crail
9c4c9f6782
Refactor check for standard stream interactivity.
...
Since several utilities check if the standard streams are interactive, I
moved this into the uucore::fs library as is_std*_interactive(). I also
added Windows support for these methods, which only return false (or at
least until someone finds a way to support this).
2020-11-08 19:56:49 -06:00
Joseph Crail
14eccb4335
uucore: specify a few modules to be Unix-only
2020-11-08 19:56:49 -06:00
Michael Gehring
23e0315262
Remove deprecated lint
2020-11-08 19:56:49 -06:00
Joseph Crail
6095dfee66
Split utility files into separate library.
...
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.
Fixes #717 .
2020-11-08 19:56:42 -06:00
Sylvestre Ledru
5c8e47a4d1
Remove version mgmt, it is done by clap
2020-11-08 17:55:31 +01:00
Sylvestre Ledru
897bcb2e67
refactor(mkdir): Move to clap + add a test
2020-11-08 17:51:04 +01:00
Sylvestre Ledru
92d5d47434
refactor(pwd): move to clap + add a test
2020-11-03 23:12:16 +01:00
Sylvestre Ledru
8bd533ffe8
refactor(uptime): some minor improvements
2020-11-03 23:10:32 +01:00
Sylvestre Ledru
a3f3a050a8
Merge pull request #1618 from sylvestre/wc-clap
...
refactor(wc): use clap instead of getopts
2020-11-03 09:39:53 +01:00
Sylvestre Ledru
38e90b9a03
Merge pull request #1621 from sylvestre/clap-stat
...
refactor(stat): Move to clap
2020-11-03 08:37:39 +01:00
Sylvestre Ledru
57c83db6b6
Merge pull request #1616 from sylvestre/users
...
refactor(users): move to clap and simplify the code a bit
2020-11-03 08:37:16 +01:00
Sylvestre Ledru
bd41cb621b
Merge pull request #1620 from sylvestre/clap-printenv
...
refactor(printenv): use clap instead of getopts
2020-11-03 08:36:56 +01:00
Sylvestre Ledru
32ccd7d54d
Merge pull request #1619 from sylvestre/rmdir-clap
...
refactor(rmdir): use clap instead of getopts
2020-11-03 08:36:25 +01:00
Sylvestre Ledru
daf0f96b94
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:47:55 +01:00
Sylvestre Ledru
2ad587ccbd
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:32:44 +01:00
Sylvestre Ledru
1e37c29b1f
refactor(stat): Move to clap
2020-11-02 22:18:51 +01:00
Sylvestre Ledru
58099f4203
refactor(wc): use clap instead of getopts
2020-10-29 20:40:00 +01:00
Roy Ivy III
effb94b03e
Merge pull request #1571 from nbraud + rivy
...
perf/factor ~ deduplicate divisors
2020-10-26 15:28:46 -05:00
Roy Ivy III
7827716dad
update dependencies (Cargo.lock; using cargo +1.32.0 update
)
2020-10-26 15:26:25 -05:00
Roy Ivy III
94e240a2fc
tests/factor ~ refactor for readability + improve DRY
2020-10-26 15:06:29 -05:00
Roy Ivy III
114fda0519
tests ~ (sub-crate factor) refactor divisor() test for improved readability
2020-10-26 15:06:29 -05:00
Roy Ivy III
ae06368cd8
polish/factor ~ correct spelling
2020-10-26 15:06:29 -05:00
Roy Ivy III
c5296f00d0
tests/factor ~ test first 100000 integers for expected results
2020-10-26 15:06:29 -05:00
Roy Ivy III
6a525c950d
perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)
2020-10-26 15:06:29 -05:00
Roy Ivy III
6eea8c5f30
perf/factor ~ improve factor() quotient and loop comparison (~6% time improvement)
2020-10-26 15:06:28 -05:00
Roy Ivy III
368f47381b
fix/factor ~ fix fault when factoring number composed of a squared factor
2020-10-26 15:06:28 -05:00
Roy Ivy III
8593b4c46c
tests ~ (sub-crate/factor) add tests for known prior factorization failures
2020-10-26 15:06:28 -05:00
Roy Ivy III
2615abe9cc
tests/factor ~ update RNG usage and variable reports to ease debugging
2020-10-26 15:06:28 -05:00
Roy Ivy III
3bb3080170
factor/refactor ~ fix cargo clippy
complaints (allow many_single_char_names)
2020-10-26 15:06:28 -05:00
nicoo
0d39732300
factor::Decomposition: Inline a small number (4) of factors
...
This avoids allocating on the heap when factoring most numbers,
without using much space on the stack.
This is ~3.5% faster than the previous commit, and ~8.3% faster than “master”.
2020-10-26 15:06:28 -05:00
nicoo
78ae0cca31
factor: Slightly refactor main loop, fix bug
2020-10-26 15:06:28 -05:00
nicoo
b7b0c76b8e
factor::Decomposition: Optimise as a factor is never added twice
...
The invariant is checked by a debug_assert!, and follows from the previous
commit, as `dec` and `factors` only ever contains coprime numbers:
- true at the start: factor = ∅ and dec = { n¹ } ;
- on every loop iteration, we pull out an element `f` from `dec` and either:
- discover it is prime, and add it to `factors` ;
- split it into a number of coprime factors, that get reinserted into `dec`;
the invariant is maintained, as all divisors of `f` are coprime with all
numbers in `dec` and `factors` (as `f` itself is coprime with them.
As we only add elements to `Decomposition` objects that are coprime with the
existing ones, they are distinct.
2020-10-26 15:06:28 -05:00
nicoo
ce218e01b6
factor: Ensure we only need to find every single factor once [WiP]
...
~17% faster, many optimisation opportunities still missed >:)
2020-10-26 15:06:28 -05:00
nicoo
3743a3e1e7
factor: Derecursify and refactor
...
~7% slowdown, paves the way for upcoming improvements
2020-10-26 15:06:28 -05:00
nicoo
8643489096
factor::Factors: Use a RefCell rather than copy data when printing
...
~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-10-26 15:06:28 -05:00
nicoo
30f9cf32f2
factor::Decomposition: Use a flat vector representation
...
~18% faster than BTreeMap, and ~5% faster than 'master'
2020-10-26 15:06:27 -05:00
nicoo
b8ef58c002
factor::Factors: Split off a Decomposition type
...
The new type can be used to represent in-progress factorisations,
which contain non-prime factors.
2020-10-26 15:06:27 -05:00
nicoo
6158cd5714
factor: Introduce a type alias for exponents
...
This way, we can easily replace u8 with a larger type when moving to support
larger integers.
2020-10-26 15:06:27 -05:00
Sylvestre Ledru
af151703b3
refactor(rmdir): use clap instead of getopts
2020-10-26 09:53:55 +01:00
Sylvestre Ledru
17a99f8e53
refactor(printenv): use clap instead of getopts
2020-10-26 09:52:53 +01:00