alloy-rs / alloy-rs/ruint

`algorithms/gcd/matrix`: Is it safe to do this based on just the u128 prefix?

Đang mở
#122 0 bình luận 0 reaction 1 người được giao Được @recmo nhận Xem trên GitHub
to do tracker
Ngôn ngữ chính
Rust
Star
225
Fork
70
Merge trung bình
16 giờ 54 phút
Pull request đã merge (30 ngày)
8

Mô tả

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

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();
let r0s = r0 << s;
let r1s = r1 << s;
let qn = Self::from_u64_prefix((r0s >> 64) as u64, (r1s >> 64) as
u64);

```rust
// 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();
// let r0s = r0 << s;
// let r1s = r1 << s;
// let qn = Self::from_u64_prefix((r0s >> 64) as u64, (r1s >> 64) as
// u64);

// // Multiply matrices qn * q
// qn.compose(q)
}
}

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.