Use EntityRef::from_u32 to reduce casting.

This commit is contained in:
Dan Gohman
2018-12-11 12:25:06 -08:00
parent a55c933f19
commit bc18085ad1
6 changed files with 27 additions and 34 deletions

View File

@@ -85,9 +85,9 @@ impl From<ValueDef> for ExpandedProgramPoint {
impl From<ProgramPoint> for ExpandedProgramPoint {
fn from(pp: ProgramPoint) -> Self {
if pp.0 & 1 == 0 {
ExpandedProgramPoint::Inst(Inst::new((pp.0 / 2) as usize))
ExpandedProgramPoint::Inst(Inst::from_u32(pp.0 / 2))
} else {
ExpandedProgramPoint::Ebb(Ebb::new((pp.0 / 2) as usize))
ExpandedProgramPoint::Ebb(Ebb::from_u32(pp.0 / 2))
}
}
}