aboutsummaryrefslogtreecommitdiff
path: root/src/passwordmaker/base_conversion/iterative_conversion_impl
Commit message (Collapse)AuthorAgeFilesLines
* Minor: Restore compatibility with Rust 1.52v0.2.1Andreas Grois2023-01-211-1/+1
|
* Fix doc error.Andreas Grois2022-11-041-1/+1
|
* More Clippy lints.Andreas Grois2022-11-042-12/+12
| | | | Now Clippy is happy.
* Some clippy lints.Andreas Grois2022-11-041-32/+37
| | | | | Some were fixed, some were ignored because they seem to make a (negative) performance impact.
* Test that compare iterative conversion with div.Andreas Grois2022-11-031-1/+52
| | | | | These tests compare the code for iterative base conversion with the alternative formula that spits out digits in reverse order.
* Base Conv: Combine shifting and padding.Andreas Grois2022-10-271-19/+62
| | | | | | Having one function that does both seems to be measurably faster, though I would have expected the compiler to inline and generate comparable assembly. Well, seems it didn't.
* Minor: Remove an unnecessary clone.Andreas Grois2022-10-261-1/+1
|
* Minor, remove a pointless type conversion.Andreas Grois2022-10-261-3/+3
| | | | Seems not to have any performance impact, but still, cleaner this way.
* Use MulAssign in BaseConversion.Andreas Grois2022-10-261-2/+32
| | | | | | | | | | Benchmarks show that MulAssign is quite a bit faster than Mul, especially since in this case it's mathematically proven that the multiplication cannot overflow. Also, removed skipping of leading zeros in long division. With the switch to multiplication after the first iteration, the chance that there actually are any leading zeros is on the order of 2^-26. I think at least. In any case, it's small.
* Merge branch 'main' into feature/heap-allocation-free-base-conversionAndreas Grois2022-10-241-1/+1
|
* Add precomputed constants for common cases.Andreas Grois2022-10-233-7/+87
| | | | | | There are now 2 features that control the amount of precomputed constants. They can either be 0, 12, or 256. Most users will likely want to go with the 12, so this is the default feature.
* Rename "potency" to "power", the English term.Andreas Grois2022-10-232-33/+33
| | | | | It seems English doesn't use the word potency in this context, but rather uses power.
* Precompute power+exponent for iterative conversionAndreas Grois2022-10-232-0/+1000
The maximum power of the base that can fit into a given data type is constant. There's no point in computing it at runtime, if we can just store it in a compile-time constants array. The code isn't the most beautiful, but that's mostly because Rust const functions are still a bit limited. One function was duplicated, because it was easy to get a slow version to compile in const context, and const context doesn't really care...