Skip to content

Commit 3b1ace9

Browse files
committed
Updated copyright year on shootout-binarytrees.rs
1 parent a4a8a4a commit 3b1ace9

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

src/test/bench/shootout-binarytrees.rs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// xfail-test
2-
3-
// Broken due to arena API problems.
4-
5-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
62
// file at the top-level directory of this distribution and at
73
// http://rust-lang.org/COPYRIGHT.
84
//
@@ -15,29 +11,29 @@
1511
extern mod extra;
1612
use extra::arena;
1713

18-
enum tree<'self> {
19-
nil,
20-
node(&'self tree<'self>, &'self tree<'self>, int),
14+
enum Tree<'self> {
15+
Nil,
16+
Node(&'self Tree<'self>, &'self Tree<'self>, int),
2117
}
2218

23-
fn item_check(t: &tree) -> int {
19+
fn item_check(t: &Tree) -> int {
2420
match *t {
25-
nil => { return 0; }
26-
node(left, right, item) => {
21+
Nil => { return 0; }
22+
Node(left, right, item) => {
2723
return item + item_check(left) - item_check(right);
2824
}
2925
}
3026
}
3127

32-
fn bottom_up_tree<'r>(arena: &'r mut arena::Arena, item: int, depth: int)
33-
-> &'r tree<'r> {
28+
fn bottom_up_tree<'r>(arena: &'r arena::Arena, item: int, depth: int)
29+
-> &'r Tree<'r> {
3430
if depth > 0 {
3531
return arena.alloc(
36-
|| node(bottom_up_tree(arena, 2 * item - 1, depth - 1),
32+
|| Node(bottom_up_tree(arena, 2 * item - 1, depth - 1),
3733
bottom_up_tree(arena, 2 * item, depth - 1),
3834
item));
3935
}
40-
return arena.alloc(|| nil);
36+
return arena.alloc(|| Nil);
4137
}
4238

4339
fn main() {
@@ -61,25 +57,25 @@ fn main() {
6157
max_depth = n;
6258
}
6359

64-
let mut stretch_arena = arena::Arena();
60+
let stretch_arena = arena::Arena();
6561
let stretch_depth = max_depth + 1;
66-
let stretch_tree = bottom_up_tree(&mut stretch_arena, 0, stretch_depth);
62+
let stretch_tree = bottom_up_tree(&stretch_arena, 0, stretch_depth);
6763

6864
println(fmt!("stretch tree of depth %d\t check: %d",
6965
stretch_depth,
7066
item_check(stretch_tree)));
7167

72-
let mut long_lived_arena = arena::Arena();
73-
let long_lived_tree = bottom_up_tree(&mut long_lived_arena, 0, max_depth);
68+
let long_lived_arena = arena::Arena();
69+
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
7470
let mut depth = min_depth;
7571
while depth <= max_depth {
7672
let iterations = int::pow(2, (max_depth - depth + min_depth) as uint);
7773
let mut chk = 0;
7874
let mut i = 1;
7975
while i <= iterations {
80-
let mut temp_tree = bottom_up_tree(&mut long_lived_arena, i, depth);
76+
let mut temp_tree = bottom_up_tree(&long_lived_arena, i, depth);
8177
chk += item_check(temp_tree);
82-
temp_tree = bottom_up_tree(&mut long_lived_arena, -i, depth);
78+
temp_tree = bottom_up_tree(&long_lived_arena, -i, depth);
8379
chk += item_check(temp_tree);
8480
i += 1;
8581
}

0 commit comments

Comments
 (0)