Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c40e004
gai: remove typo from test file, and add a reference id
tshepang Jul 2, 2025
a2d66db
remove unsused div_rem method from bignum
Kivooeo Sep 6, 2025
cb81972
tidy: Introduce `WorkspaceInfo` struct for deps information
clubby789 Sep 10, 2025
ba874d3
tidy: Print crate name on dependency error
clubby789 Sep 10, 2025
adfb6ec
tidy: More accurate permitted dependencies location
clubby789 Sep 10, 2025
11a22b3
tidy: Add specific line info for allowed dependencies
clubby789 Sep 10, 2025
fefc979
bootstrap: Show target in "No such target exists" message
neuschaefer Sep 12, 2025
2e652d7
Improve `core::fmt` coverage
pvdrz Sep 12, 2025
dd4562a
tests: update new test to accept new lifetime format
durin42 Sep 12, 2025
87ae4db
Improve `core::ptr` coverage
pvdrz Sep 12, 2025
a48c8e3
compiletest: Fix `--exact` test filtering
Enselic Sep 13, 2025
37d058f
tidy: Remove `WorkspaceInfo` constructor
clubby789 Sep 14, 2025
f96bc5c
Rollup merge of #143314 - tshepang:fix-filename, r=compiler-errors
matthiaskrgr Sep 15, 2025
fa63dbf
Rollup merge of #146284 - Kivooeo:blazing-fast-division-bignum, r=Mar…
matthiaskrgr Sep 15, 2025
b59f0a2
Rollup merge of #146416 - clubby789:tidy-deps-qol, r=jieyouxu
matthiaskrgr Sep 15, 2025
d316cfd
Rollup merge of #146471 - neuschaefer:no-target, r=Mark-Simulacrum
matthiaskrgr Sep 15, 2025
9070e95
Rollup merge of #146478 - ferrocene:pvdrz/improve-fmt-coverage, r=Mar…
matthiaskrgr Sep 15, 2025
b82698b
Rollup merge of #146480 - durin42:llvm-22-more-lifetime, r=Mark-Simul…
matthiaskrgr Sep 15, 2025
32c045e
Rollup merge of #146488 - ferrocene:pvdrz/improve-ptr-coverage, r=Mar…
matthiaskrgr Sep 15, 2025
0a14ae0
Rollup merge of #146501 - Enselic:x-test-filter, r=Mark-Simulacrum
matthiaskrgr Sep 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions library/core/src/num/bignum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
19 changes: 0 additions & 19 deletions library/coretests/tests/num/bignum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,25 +167,6 @@ fn test_div_rem_small() {
);
}

#[test]
fn test_div_rem() {
fn div_rem(n: u64, d: u64) -> (Big, Big) {
let mut q = Big::from_small(42);
let mut r = Big::from_small(42);
Big::from_u64(n).div_rem(&Big::from_u64(d), &mut q, &mut r);
(q, r)
}
assert_eq!(div_rem(1, 1), (Big::from_small(1), Big::from_small(0)));
assert_eq!(div_rem(4, 3), (Big::from_small(1), Big::from_small(1)));
assert_eq!(div_rem(1, 7), (Big::from_small(0), Big::from_small(1)));
assert_eq!(div_rem(45, 9), (Big::from_small(5), Big::from_small(0)));
assert_eq!(div_rem(103, 9), (Big::from_small(11), Big::from_small(4)));
assert_eq!(div_rem(123456, 77), (Big::from_u64(1603), Big::from_small(25)));
assert_eq!(div_rem(0xffff, 1), (Big::from_u64(0xffff), Big::from_small(0)));
assert_eq!(div_rem(0xeeee, 0xffff), (Big::from_small(0), Big::from_u64(0xeeee)));
assert_eq!(div_rem(2_000_000, 2), (Big::from_u64(1_000_000), Big::from_u64(0)));
}

#[test]
fn test_is_zero() {
assert!(Big::from_small(0).is_zero());
Expand Down