Skip to content

Commit

Permalink
auto merge of #10410 : willingc/rust/shoot-done, r=huonw
Browse files Browse the repository at this point in the history
...e.

Cleaned up unneeded imports and type changes to resolve compiler warnings.

Work in process
  • Loading branch information
bors committed Nov 12, 2013
2 parents 3b0d486 + 33ee433 commit 2d6952e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/test/bench/shootout-ackermann.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

extern mod extra;

use std::int;
use std::os;

fn ack(m: int, n: int) -> int {
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/shootout-chameneos-redux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::comm::{stream, SharedChan};
use std::option;
use std::os;
use std::task;
use std::uint;

fn print_complements() {
let all = [Blue, Red, Yellow];
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/shootout-fibo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

extern mod extra;

use std::int;
use std::os;

fn fib(n: int) -> int {
Expand Down
19 changes: 13 additions & 6 deletions src/test/bench/shootout-nbody.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// xfail-test reading from os::args()[1] - bogus!

use std::from_str::FromStr;
use std::os;

static PI: f64 = 3.141592653589793;
Expand Down Expand Up @@ -139,13 +136,23 @@ fn offset_momentum(bodies: &mut [Planet, ..N_BODIES]) {
}

fn main() {
let n: i32 = FromStr::from_str(os::args()[1]).unwrap();
let args = os::args();
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"1000"]
} else if args.len() <= 1u {
~[~"", ~"1000"]
} else {
args
};

let n: i32 = from_str::<i32>(args[1]).unwrap();
let mut bodies = BODIES;

offset_momentum(&mut bodies);
println!("{:.9f}", energy(&bodies) as float);
println!("{:.9f}", energy(&bodies) as f64);

advance(&mut bodies, 0.01, n);

println!("{:.9f}", energy(&bodies) as float);
println!("{:.9f}", energy(&bodies) as f64);
}

0 comments on commit 2d6952e

Please sign in to comment.