Skip to content

Commit a0ea210

Browse files
committed
auto merge of #17957 : TeXitoi/rust/fix-mandelbrot, r=alexcrichton
2 parents 70d8b8d + 6165875 commit a0ea210

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/test/bench/shootout-mandelbrot.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,15 @@ fn mandelbrot<W: io::Writer>(w: uint, mut out: W) -> io::IoResult<()> {
126126
Future::spawn(proc () {
127127
let mut res: Vec<u8> = Vec::with_capacity((chunk_size * w) / 8);
128128
let init_r_slice = vec_init_r.as_slice();
129-
for &init_i in vec_init_i.slice(i * chunk_size, (i + 1) * chunk_size).iter() {
129+
130+
let start = i * chunk_size;
131+
let end = if i == (WORKERS - 1) {
132+
start + last_chunk_size
133+
} else {
134+
(i + 1) * chunk_size
135+
};
136+
137+
for &init_i in vec_init_i.slice(start, end).iter() {
130138
write_line(init_i, init_r_slice, &mut res);
131139
}
132140

0 commit comments

Comments
 (0)