@@ -13,40 +13,40 @@ use std::rand;
13
13
use std:: rand:: Rng ;
14
14
use test:: { Bencher , black_box} ;
15
15
16
- pub fn insert_rand_n < M , I , R > ( n : uint ,
16
+ pub fn insert_rand_n < M , I , R > ( n : usize ,
17
17
map : & mut M ,
18
18
b : & mut Bencher ,
19
19
mut insert : I ,
20
20
mut remove : R ) where
21
- I : FnMut ( & mut M , uint ) ,
22
- R : FnMut ( & mut M , uint ) ,
21
+ I : FnMut ( & mut M , usize ) ,
22
+ R : FnMut ( & mut M , usize ) ,
23
23
{
24
24
// setup
25
25
let mut rng = rand:: weak_rng ( ) ;
26
26
27
27
for _ in 0 ..n {
28
- insert ( map, rng. gen :: < uint > ( ) % n) ;
28
+ insert ( map, rng. gen :: < usize > ( ) % n) ;
29
29
}
30
30
31
31
// measure
32
32
b. iter ( || {
33
- let k = rng. gen :: < uint > ( ) % n;
33
+ let k = rng. gen :: < usize > ( ) % n;
34
34
insert ( map, k) ;
35
35
remove ( map, k) ;
36
36
} ) ;
37
37
black_box ( map) ;
38
38
}
39
39
40
- pub fn insert_seq_n < M , I , R > ( n : uint ,
40
+ pub fn insert_seq_n < M , I , R > ( n : usize ,
41
41
map : & mut M ,
42
42
b : & mut Bencher ,
43
43
mut insert : I ,
44
44
mut remove : R ) where
45
- I : FnMut ( & mut M , uint ) ,
46
- R : FnMut ( & mut M , uint ) ,
45
+ I : FnMut ( & mut M , usize ) ,
46
+ R : FnMut ( & mut M , usize ) ,
47
47
{
48
48
// setup
49
- for i in 0 u ..n {
49
+ for i in 0 ..n {
50
50
insert ( map, i * 2 ) ;
51
51
}
52
52
@@ -60,18 +60,17 @@ pub fn insert_seq_n<M, I, R>(n: uint,
60
60
black_box ( map) ;
61
61
}
62
62
63
- pub fn find_rand_n < M , T , I , F > ( n : uint ,
63
+ pub fn find_rand_n < M , T , I , F > ( n : usize ,
64
64
map : & mut M ,
65
65
b : & mut Bencher ,
66
66
mut insert : I ,
67
67
mut find : F ) where
68
- I : FnMut ( & mut M , uint ) ,
69
- F : FnMut ( & M , uint ) -> T ,
68
+ I : FnMut ( & mut M , usize ) ,
69
+ F : FnMut ( & M , usize ) -> T ,
70
70
{
71
71
// setup
72
72
let mut rng = rand:: weak_rng ( ) ;
73
- let mut keys = ( 0 ..n) . map ( |_| rng. gen :: < uint > ( ) % n)
74
- . collect :: < Vec < _ > > ( ) ;
73
+ let mut keys: Vec < _ > = ( 0 ..n) . map ( |_| rng. gen :: < usize > ( ) % n) . collect ( ) ;
75
74
76
75
for k in & keys {
77
76
insert ( map, * k) ;
@@ -88,16 +87,16 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
88
87
} )
89
88
}
90
89
91
- pub fn find_seq_n < M , T , I , F > ( n : uint ,
90
+ pub fn find_seq_n < M , T , I , F > ( n : usize ,
92
91
map : & mut M ,
93
92
b : & mut Bencher ,
94
93
mut insert : I ,
95
94
mut find : F ) where
96
- I : FnMut ( & mut M , uint ) ,
97
- F : FnMut ( & M , uint ) -> T ,
95
+ I : FnMut ( & mut M , usize ) ,
96
+ F : FnMut ( & M , usize ) -> T ,
98
97
{
99
98
// setup
100
- for i in 0 u ..n {
99
+ for i in 0 ..n {
101
100
insert ( map, i) ;
102
101
}
103
102
0 commit comments