uint
uint copied to clipboard
Rust Uint crate using const-generics
*On 2022-06-06 @recmo wrote in [`4c74c09`](https://github.com/recmo/uint/commit/4c74c09b4d6f425cda931e9f5e8d00f1367c4261) “Merge pull request #110 from recmo/gcd”:* Can we reuse the shifted variables here? ```rust // We can return q here and have a perfectly...
*On 2022-06-06 @recmo wrote in [`4c74c09`](https://github.com/recmo/uint/commit/4c74c09b4d6f425cda931e9f5e8d00f1367c4261) “Merge pull request #110 from recmo/gcd”:* Rewrite using to_u64 -> Option ```rust // We shadow s for readability. #[allow(clippy::shadow_unrelated)] fn lehmer_double(mut r0: U256, mut...
*On 2022-06-06 @recmo wrote in [`4c74c09`](https://github.com/recmo/uint/commit/4c74c09b4d6f425cda931e9f5e8d00f1367c4261) “Merge pull request #110 from recmo/gcd”:* We can update r0 and r1 in place. This won't remove the partially redundant call to lehmer_update, but...
*On 2022-06-06 @recmo wrote in [`4c74c09`](https://github.com/recmo/uint/commit/4c74c09b4d6f425cda931e9f5e8d00f1367c4261) “Merge pull request #110 from recmo/gcd”:* Would this be faster using extended binary gcd? We shadow q for readability. ```rust } /// Compute the...
*On 2022-06-03 @recmo wrote in [`2f6a5d6`](https://github.com/recmo/uint/commit/2f6a5d6b21bed46723e8815a63a1724187aa59b1) “Merge pull request #103 from recmo/mulmod”:* a^b)^c = a^(b * c). Which requires carmichael fn. ```rust // TODO: Increase cases when perf is better....
*On 2022-06-03 @recmo wrote in [`2f6a5d6`](https://github.com/recmo/uint/commit/2f6a5d6b21bed46723e8815a63a1724187aa59b1) “Merge pull request #103 from recmo/mulmod”:* Increase cases when perf is better. ```rust #[test] fn test_pow_rules() { const_for!(BITS in NON_ZERO { const LIMBS: usize...
*On 2022-06-03 @recmo wrote in [`2f6a5d6`](https://github.com/recmo/uint/commit/2f6a5d6b21bed46723e8815a63a1724187aa59b1) “Merge pull request #103 from recmo/mulmod”:* Reduce larger bit-sizes to smaller ones. ```rust /// ⚠️ Compute $\mod{\mathtt{self}}_{\mathtt{modulus}}$. /// /// **Warning.** This function is not...
*On 2022-06-03 @recmo wrote in [`2f6a5d6`](https://github.com/recmo/uint/commit/2f6a5d6b21bed46723e8815a63a1724187aa59b1) “Merge pull request #103 from recmo/mulmod”:* Modular wrapper class, like Wrapping. ```rust use crate::{algorithms, nlimbs, Uint}; // FEATURE: sub_mod, neg_mod, inv_mod, div_mod, root_mod //...
*On 2022-05-31 @recmo wrote in [`c1a0c34`](https://github.com/recmo/uint/commit/c1a0c34df8ab6d3411ad79c27b72ad812eff78e4) “Merge pull request #97 from recmo/isqrt”:* A dedicated function avoiding full-sized shift. ```rust #[allow(clippy::cast_sign_loss)] // fract >= 0. let bits = (fract.exp2() * EXP2_63)...
*On 2022-05-31 @recmo wrote in [`c1a0c34`](https://github.com/recmo/uint/commit/c1a0c34df8ab6d3411ad79c27b72ad812eff78e4) “Merge pull request #97 from recmo/isqrt”:* Round negative to zero. Self::BITS ~< 2^52 and so fits f64. ```rust #[must_use] pub fn approx_pow2(exp: f64) ->...