alloy-rs / alloy-rs/ruint

`algorithms/gcd/matrix`: We can update r0 and r1 in place. This won't remove the partially

Abierto
#120 0 comentarios 0 reacciones 1 asignado Reclamado por @recmo Ver en GitHub
optimize tracker
Lenguaje dominante
Rust
Estrellas
225
Forks
70
Merge medio
16 h 54 min
PR fusionados (30 d)
8

Descripción

*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 it reduces memory usage.

```rust
/// Our approach is similar to Cohen, but instead doing the second round
/// on the same matrix, we start we a fresh matrix and multiply both in the
/// end. This requires 8 additional multiplications, but allows us to use
/// the tighter stopping conditions from Jebelean. It also seems the
/// simplest out of these solutions.
// OPT: We can update r0 and r1 in place. This won't remove the partially
// redundant call to lehmer_update, but it reduces memory usage.
#[must_use]
pub fn from_u128_prefix(r0: u128, r1: u128) -> Self {
debug_assert!(r0 >= r1);
let s = r0.leading_zeros();
let r0s = r0 << s;

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.