Skip to content

Commit 1388c05

Browse files
committed
Remove free-standing div functions in std::uint
1 parent 4109caf commit 1388c05

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/libstd/num/uint.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,59 +25,6 @@ use unstable::intrinsics;
2525

2626
uint_module!(uint, int, ::int::BITS)
2727

28-
///
29-
/// Divide two numbers, return the result, rounded up.
30-
///
31-
/// # Arguments
32-
///
33-
/// * x - an integer
34-
/// * y - an integer distinct from 0u
35-
///
36-
/// # Return value
37-
///
38-
/// The smallest integer `q` such that `x/y <= q`.
39-
///
40-
pub fn div_ceil(x: uint, y: uint) -> uint {
41-
let div = x / y;
42-
if x % y == 0u { div }
43-
else { div + 1u }
44-
}
45-
46-
///
47-
/// Divide two numbers, return the result, rounded to the closest integer.
48-
///
49-
/// # Arguments
50-
///
51-
/// * x - an integer
52-
/// * y - an integer distinct from 0u
53-
///
54-
/// # Return value
55-
///
56-
/// The integer `q` closest to `x/y`.
57-
///
58-
pub fn div_round(x: uint, y: uint) -> uint {
59-
let div = x / y;
60-
if x % y * 2u < y { div }
61-
else { div + 1u }
62-
}
63-
64-
///
65-
/// Divide two numbers, return the result, rounded down.
66-
///
67-
/// Note: This is the same function as `div`.
68-
///
69-
/// # Arguments
70-
///
71-
/// * x - an integer
72-
/// * y - an integer distinct from 0u
73-
///
74-
/// # Return value
75-
///
76-
/// The smallest integer `q` such that `x/y <= q`. This
77-
/// is either `x/y` or `x/y + 1`.
78-
///
79-
pub fn div_floor(x: uint, y: uint) -> uint { return x / y; }
80-
8128
#[cfg(target_word_size = "32")]
8229
impl CheckedAdd for uint {
8330
#[inline]
@@ -151,10 +98,3 @@ fn test_overflows() {
15198
assert!((uint::MIN <= 0u));
15299
assert!((uint::MIN + uint::MAX + 1u == 0u));
153100
}
154-
155-
#[test]
156-
fn test_div() {
157-
assert!((div_floor(3u, 4u) == 0u));
158-
assert!((div_ceil(3u, 4u) == 1u));
159-
assert!((div_round(3u, 4u) == 1u));
160-
}

0 commit comments

Comments
 (0)