@@ -25,59 +25,6 @@ use unstable::intrinsics;
25
25
26
26
uint_module ! ( uint, int, :: int:: BITS )
27
27
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 == 0 u { div }
43
- else { div + 1 u }
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 * 2 u < y { div }
61
- else { div + 1 u }
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
-
81
28
#[ cfg( target_word_size = "32" ) ]
82
29
impl CheckedAdd for uint {
83
30
#[ inline]
@@ -151,10 +98,3 @@ fn test_overflows() {
151
98
assert ! ( ( uint:: MIN <= 0 u) ) ;
152
99
assert ! ( ( uint:: MIN + uint:: MAX + 1 u == 0 u) ) ;
153
100
}
154
-
155
- #[ test]
156
- fn test_div ( ) {
157
- assert ! ( ( div_floor( 3 u, 4 u) == 0 u) ) ;
158
- assert ! ( ( div_ceil( 3 u, 4 u) == 1 u) ) ;
159
- assert ! ( ( div_round( 3 u, 4 u) == 1 u) ) ;
160
- }
0 commit comments