`algorithms/div/small`: Version with in-place shifting of `u`
- Lingua principale
- Rust
- Stelle
- 225
- Fork
- 70
- Merge medio
- 16h 54m
- PR unite (30g)
- 8
Descrizione
*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)*
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.