]> git.lizzy.rs Git - rust.git/commitdiff
Really fix #17982 this time.
authorVadim Chugunov <vadimcn@gmail.com>
Fri, 31 Oct 2014 00:26:07 +0000 (17:26 -0700)
committerVadim Chugunov <vadimcn@gmail.com>
Fri, 31 Oct 2014 01:01:02 +0000 (18:01 -0700)
src/libterm/win.rs

index 7ce6fb658b56d36a5998da51f3507a844b3c8d60..9a67ee8836baecfb30d2cca5f6ade9442ec261ae 100644 (file)
@@ -71,8 +71,7 @@ fn color_to_bits(color: color::Color) -> u16 {
 }
 
 fn bits_to_color(bits: u16) -> color::Color {
-    let bits = bits & 0x7;
-    let color = match bits {
+    let color = match bits & 0x7 {
         0 => color::BLACK,
         0x1 => color::BLUE,
         0x2 => color::GREEN,
@@ -84,11 +83,7 @@ fn bits_to_color(bits: u16) -> color::Color {
         _ => unreachable!()
     };
 
-    if bits >= 8 {
-        color | 0x8
-    } else {
-        color
-    }
+    color | (bits & 0x8) // copy the hi-intensity bit
 }
 
 impl<T: Writer+Send> WinConsole<T> {