Skip to content

Commit ef352fa

Browse files
committed
auto merge of #15743 : Ryman/rust/mandelbrot_fix, r=alexcrichton
Matches the official sample output (N=200) again. cc #15408
2 parents 7502b4c + 407fe9a commit ef352fa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/bench/shootout-mandelbrot.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn mandelbrot<W: io::Writer>(w: uint, mut out: W) -> io::IoResult<()> {
6464
let chunk_size = h / WORKERS;
6565

6666
// Account for remainders in workload division, e.g. 1000 / 16 = 62.5
67-
let first_chunk_size = if h % WORKERS != 0 {
67+
let last_chunk_size = if h % WORKERS != 0 {
6868
chunk_size + h % WORKERS
6969
} else {
7070
chunk_size
@@ -87,8 +87,8 @@ fn mandelbrot<W: io::Writer>(w: uint, mut out: W) -> io::IoResult<()> {
8787
let mut is = Vec::with_capacity(w / WORKERS);
8888

8989
let start = i * chunk_size;
90-
let end = if i == 0 {
91-
first_chunk_size
90+
let end = if i == (WORKERS - 1) {
91+
start + last_chunk_size
9292
} else {
9393
(i + 1) * chunk_size
9494
};

0 commit comments

Comments
 (0)