diff options
| author | bors <bors@rust-lang.org> | 2025-09-15 04:16:42 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-09-15 04:16:42 +0000 | 
| commit | d1ed52b1f5b78bf66127b670af813b84d57aeedb (patch) | |
| tree | fcfe4384f549404920ee1c0c6dd91f11a19e7734 /library/core/src | |
| parent | 52618eb338609df44978b0ca4451ab7941fd1c7a (diff) | |
| parent | 0a14ae0fad50f81ff20dd91fa2c44d6d3cad48d2 (diff) | |
| download | rust-d1ed52b1f5b78bf66127b670af813b84d57aeedb.tar.gz rust-d1ed52b1f5b78bf66127b670af813b84d57aeedb.zip | |
Auto merge of #146572 - matthiaskrgr:rollup-gotklb6, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#143314 (add reference id to test, and fix filename) - rust-lang/rust#146284 (Remove `div_rem` from `core::num::bignum`) - rust-lang/rust#146416 (Tidy dependency checks cleanups + QoL) - rust-lang/rust#146471 (bootstrap: Show target in "No such target exists" message) - rust-lang/rust#146478 (Improve `core::fmt` coverage) - rust-lang/rust#146480 (tests: update new test to accept new lifetime format) - rust-lang/rust#146488 (Improve `core::ptr` coverage) - rust-lang/rust#146501 (compiletest: Fix `--exact` test filtering) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/num/bignum.rs | 37 | 
1 files changed, 0 insertions, 37 deletions
| diff --git a/library/core/src/num/bignum.rs b/library/core/src/num/bignum.rs index e33f58197bb..f21fe0b4438 100644 --- a/library/core/src/num/bignum.rs +++ b/library/core/src/num/bignum.rs @@ -335,43 +335,6 @@ macro_rules! define_bignum { } (self, borrow) } - - /// Divide self by another bignum, overwriting `q` with the quotient and `r` with the - /// remainder. - pub fn div_rem(&self, d: &$name, q: &mut $name, r: &mut $name) { - // Stupid slow base-2 long division taken from - // https://en.wikipedia.org/wiki/Division_algorithm - // FIXME use a greater base ($ty) for the long division. - assert!(!d.is_zero()); - let digitbits = <$ty>::BITS as usize; - for digit in &mut q.base[..] { - *digit = 0; - } - for digit in &mut r.base[..] { - *digit = 0; - } - r.size = d.size; - q.size = 1; - let mut q_is_zero = true; - let end = self.bit_length(); - for i in (0..end).rev() { - r.mul_pow2(1); - r.base[0] |= self.get_bit(i) as $ty; - if &*r >= d { - r.sub(d); - // Set bit `i` of q to 1. - let digit_idx = i / digitbits; - let bit_idx = i % digitbits; - if q_is_zero { - q.size = digit_idx + 1; - q_is_zero = false; - } - q.base[digit_idx] |= 1 << bit_idx; - } - } - debug_assert!(q.base[q.size..].iter().all(|&d| d == 0)); - debug_assert!(r.base[r.size..].iter().all(|&d| d == 0)); - } } impl crate::cmp::PartialEq for $name { | 
