alloy-rs / alloy-rs/ruint

`algorithms/gcd/matrix`: Fix the below method to get double-word Lehmer GCD.

Offen
#121 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @recmo Auf GitHub ansehen
optimize tracker
Vorherrschende Sprache
Rust
Sterne
225
Forks
70
Ø Merge
16 Std. 54 Min.
Gemergte PRs (30 T.)
8

Beschreibung

*On 2022-06-06 @recmo wrote in [`4c74c09`](https://github.com/recmo/uint/commit/4c74c09b4d6f425cda931e9f5e8d00f1367c4261) “Merge pull request #110 from recmo/gcd”:*

Fix the below method to get double-word Lehmer GCD.

```rust
if q == Matrix::IDENTITY {
return q;
}
// We can return q here and have a perfectly valid single-word Lehmer GCD.
q
// OPT: Fix the below method to get double-word Lehmer GCD.

// Recompute r0 and r1 and take the high bits.
// TODO: Is it safe to do this based on just the u128 prefix?
// let (r0, r1) = q.apply_u128(r0, r1);
// let s = r0.leading_zeros();

```
*From [`src/algorithms/gcd/matrix.rs:312`](https://github.com/recmo/uint/blob/4c74c09b4d6f425cda931e9f5e8d00f1367c4261/src/algorithms/gcd/matrix.rs#L312)*

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.