]> git.lizzy.rs Git - rust.git/commitdiff
Clarrify the message for test mode and use u8 instead of i8 for storing bits
authorGuillaume Pinot <texitoi@texitoi.eu>
Sun, 17 Nov 2013 11:47:47 +0000 (12:47 +0100)
committerGuillaume Pinot <texitoi@texitoi.eu>
Sun, 17 Nov 2013 11:47:47 +0000 (12:47 +0100)
src/test/bench/shootout-mandelbrot.rs

index 70fd95f3d47cb462b09018dd959edc403ff7fb91..a08dfb29d3eac86be65be6db0e6584aaa6066416 100644 (file)
@@ -21,14 +21,15 @@ fn write(&mut self, _: &[u8]) {}
 fn main() {
     let args = std::os::args();
     let (w, mut out) = if args.len() < 2 {
-        println("Test mode: do not dump the image.");
+        println("Test mode: do not dump the image because it's not utf8,"
+                + " which interferes with the test runner.");
         (1000, ~DummyWriter as ~Writer)
     } else {
         (from_str(args[1]).unwrap(),
          ~BufferedWriter::new(std::io::stdout()) as ~Writer)
     };
     let h = w;
-    let mut byte_acc = 0i8;
+    let mut byte_acc = 0u8;
     let mut bit_num = 0;
 
     writeln!(out, "P4\n{} {}", w, h);
@@ -62,12 +63,12 @@ fn main() {
             bit_num += 1;
 
             if bit_num == 8 {
-                out.write_i8(byte_acc);
+                out.write_u8(byte_acc);
                 byte_acc = 0;
                 bit_num = 0;
             } else if x == w - 1 {
                 byte_acc <<= 8 - w % 8;
-                out.write_i8(byte_acc);
+                out.write_u8(byte_acc);
                 byte_acc = 0;
                 bit_num = 0;
             }