alloy-rs / alloy-rs/ruint

`algorithms/div/small`: Version with in-place shifting of `u`

Đang mở
#178 0 bình luận 0 reaction 1 người được giao Được @recmo nhận Xem trên GitHub
optimize 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-10-24 @recmo wrote in [`fb3aa20`](https://github.com/recmo/uint/commit/fb3aa200dea389e2d1b0a23981da48a77a08b738) “Merge pull request #172 from recmo/div2”:*

Version with in-place shifting of `u`

```rust
///
/// Requires `divisor` to be in the range $[2^{127}, 2^{128})$ (i.e.
/// normalized). Same as [`div_nx1`] but using [`div_3x2`] internally.
#[inline(always)]
pub fn div_nx2_normalized(u: &mut [u64], d: u128) -> u128 {
// OPT: Version with in-place shifting of `u`
debug_assert!(d >= (1 << 127));

let v = reciprocal_2(d);
let mut remainder: u128 = 0;
for u in u.iter_mut().rev() {

```
*From [`src/algorithms/div/small.rs:97`](https://github.com/recmo/uint/blob/fb3aa200dea389e2d1b0a23981da48a77a08b738/src/algorithms/div/small.rs#L97)*

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.