Skip to content

Commit 0c3b04f

Browse files
committed
Clarrify the message for test mode and use u8 instead of i8 for storing bits
1 parent 6258857 commit 0c3b04f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/bench/shootout-mandelbrot.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ static LIMIT: f64 = 2.0;
2121
fn main() {
2222
let args = std::os::args();
2323
let (w, mut out) = if args.len() < 2 {
24-
println("Test mode: do not dump the image.");
24+
println("Test mode: do not dump the image because it's not utf8,"
25+
+ " which interferes with the test runner.");
2526
(1000, ~DummyWriter as ~Writer)
2627
} else {
2728
(from_str(args[1]).unwrap(),
2829
~BufferedWriter::new(std::io::stdout()) as ~Writer)
2930
};
3031
let h = w;
31-
let mut byte_acc = 0i8;
32+
let mut byte_acc = 0u8;
3233
let mut bit_num = 0;
3334

3435
writeln!(out, "P4\n{} {}", w, h);
@@ -62,12 +63,12 @@ fn main() {
6263
bit_num += 1;
6364

6465
if bit_num == 8 {
65-
out.write_i8(byte_acc);
66+
out.write_u8(byte_acc);
6667
byte_acc = 0;
6768
bit_num = 0;
6869
} else if x == w - 1 {
6970
byte_acc <<= 8 - w % 8;
70-
out.write_i8(byte_acc);
71+
out.write_u8(byte_acc);
7172
byte_acc = 0;
7273
bit_num = 0;
7374
}

0 commit comments

Comments
 (0)