Replace as casts with type-conversion functions.

This commit is contained in:
Dan Gohman
2017-11-08 10:41:09 -08:00
parent 7c579a80c2
commit 889b06fd16
15 changed files with 54 additions and 47 deletions

View File

@@ -107,6 +107,7 @@ use std::cmp;
use std::fmt;
use std::mem;
use super::AllocatableSet;
use std::u16;
/// A variable in the constraint problem.
///
@@ -866,7 +867,7 @@ impl Solver {
// Compute domain sizes for all the variables given the current register sets.
for v in &mut self.vars {
let d = v.iter(&self.regs_in, &self.regs_out, global_regs).len();
v.domain = cmp::min(d, u16::max_value() as usize) as u16;
v.domain = cmp::min(d, u16::MAX as usize) as u16;
}
// Solve for vars with small domains first to increase the chance of finding a solution.
// Use the value number as a tie breaker to get a stable sort.