Replace as casts with type-conversion functions.
This commit is contained in:
@@ -198,7 +198,9 @@ impl<'a> fmt::Display for DisplayAllocatableSet<'a> {
|
||||
bank.names
|
||||
.get(offset as usize)
|
||||
.and_then(|name| name.chars().skip(1).next())
|
||||
.unwrap_or(char::from_digit((offset % 10) as u32, 10).unwrap())
|
||||
.unwrap_or(
|
||||
char::from_digit(u32::from(offset % 10), 10).unwrap(),
|
||||
)
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,13 +158,13 @@ impl Pressure {
|
||||
fn check_avail_aliased(&self, entry: &TopRC) -> RegClassMask {
|
||||
let first = usize::from(entry.first_toprc);
|
||||
let num = usize::from(entry.num_toprcs);
|
||||
let width = entry.width as u32;
|
||||
let width = u32::from(entry.width);
|
||||
let ulimit = entry.limit * width;
|
||||
|
||||
// Count up the number of available register units.
|
||||
let mut units = 0;
|
||||
for (rc, rci) in self.toprc[first..first + num].iter().zip(first..) {
|
||||
let rcw = rc.width as u32;
|
||||
let rcw = u32::from(rc.width);
|
||||
// If `rc.width` is smaller than `width`, each register in `rc` could potentially block
|
||||
// one of ours. This is assuming that none of the smaller registers are straddling the
|
||||
// bigger ones.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user