rustup...

This commit is contained in:
kennytm 2014-11-17 00:45:35 +08:00
parent acddb36406
commit 74bdb39149

View file

@ -11,7 +11,7 @@
use std::iter::range_inclusive; use std::iter::range_inclusive;
use std::iter::order::equals; use std::iter::order::equals;
use std::num::zero; use std::num::Int;
use std::cmp::max; use std::cmp::max;
use types::{QrVersion, Version, MicroVersion, ErrorCorrectionLevel, L, M, Q}; use types::{QrVersion, Version, MicroVersion, ErrorCorrectionLevel, L, M, Q};
@ -624,9 +624,10 @@ impl Canvas {
fn draw_number<N: Int>(&mut self, number: N, fn draw_number<N: Int>(&mut self, number: N,
on_color: Module, off_color: Module, on_color: Module, off_color: Module,
coords: &[(i16, i16)]) { coords: &[(i16, i16)]) {
let mut mask: N = !(!zero::<N>() >> 1); let zero: N = Int::zero();
let mut mask: N = !(!zero >> 1);
for &(x, y) in coords.iter() { for &(x, y) in coords.iter() {
let color = if (mask & number).is_zero() { off_color } else { on_color }; let color = if (mask & number) == zero { off_color } else { on_color };
self.put(x, y, color); self.put(x, y, color);
mask = mask >> 1; mask = mask >> 1;
} }