1
- type T = uint ;
1
+ pub type T = uint ;
2
2
3
3
#[ cfg( target_arch = "x86" ) ]
4
4
#[ cfg( target_arch = "arm" ) ]
5
- const bits: uint = 32 ;
5
+ pub const bits: uint = 32 ;
6
6
7
7
#[ cfg( target_arch = "x86_64" ) ]
8
- const bits: uint = 64 ;
8
+ pub const bits: uint = 64 ;
9
9
10
10
/**
11
11
* Divide two numbers, return the result, rounded up.
@@ -19,7 +19,7 @@ const bits: uint = 64;
19
19
*
20
20
* The smallest integer `q` such that `x/y <= q`.
21
21
*/
22
- pure fn div_ceil ( x : uint , y : uint ) -> uint {
22
+ pub pure fn div_ceil ( x : uint , y : uint ) -> uint {
23
23
let div = x / y;
24
24
if x % y == 0 u { div }
25
25
else { div + 1 u }
@@ -37,7 +37,7 @@ pure fn div_ceil(x: uint, y: uint) -> uint {
37
37
*
38
38
* The integer `q` closest to `x/y`.
39
39
*/
40
- pure fn div_round ( x : uint , y : uint ) -> uint {
40
+ pub pure fn div_round ( x : uint , y : uint ) -> uint {
41
41
let div = x / y;
42
42
if x % y * 2 u < y { div }
43
43
else { div + 1 u }
@@ -58,7 +58,7 @@ pure fn div_round(x: uint, y: uint) -> uint {
58
58
* The smallest integer `q` such that `x/y <= q`. This
59
59
* is either `x/y` or `x/y + 1`.
60
60
*/
61
- pure fn div_floor ( x : uint , y : uint ) -> uint { return x / y; }
61
+ pub pure fn div_floor ( x : uint , y : uint ) -> uint { return x / y; }
62
62
63
63
/**
64
64
* Iterate over the range [`lo`..`hi`), or stop when requested
@@ -75,7 +75,7 @@ pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
75
75
* `true` If execution proceeded correctly, `false` if it was interrupted,
76
76
* that is if `it` returned `false` at any point.
77
77
*/
78
- pure fn iterate ( lo : uint , hi : uint , it : fn ( uint ) -> bool ) -> bool {
78
+ pub pure fn iterate ( lo : uint , hi : uint , it : fn ( uint ) -> bool ) -> bool {
79
79
let mut i = lo;
80
80
while i < hi {
81
81
if ( !it ( i) ) { return false ; }
@@ -86,7 +86,7 @@ pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
86
86
87
87
/// Returns the smallest power of 2 greater than or equal to `n`
88
88
#[ inline( always) ]
89
- fn next_power_of_two ( n : uint ) -> uint {
89
+ pub fn next_power_of_two ( n : uint ) -> uint {
90
90
let halfbits: uint = sys:: size_of :: < uint > ( ) * 4 u;
91
91
let mut tmp: uint = n - 1 u;
92
92
let mut shift: uint = 1 u;
0 commit comments