Clean up simd_cast translation.

This commit is contained in:
Huon Wilson
2015-08-14 15:46:51 -07:00
parent 502f9acbe9
commit b067e4464b
2 changed files with 67 additions and 104 deletions

View File

@@ -1339,6 +1339,15 @@ impl IntTy {
TyI16 | TyI32 | TyI64 => 3,
}
}
pub fn bit_width(&self) -> Option<usize> {
Some(match *self {
TyIs => return None,
TyI8 => 8,
TyI16 => 16,
TyI32 => 32,
TyI64 => 64,
})
}
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
@@ -1357,6 +1366,15 @@ impl UintTy {
TyU16 | TyU32 | TyU64 => 3,
}
}
pub fn bit_width(&self) -> Option<usize> {
Some(match *self {
TyUs => return None,
TyU8 => 8,
TyU16 => 16,
TyU32 => 32,
TyU64 => 64,
})
}
}
impl fmt::Debug for UintTy {
@@ -1395,6 +1413,12 @@ impl FloatTy {
TyF32 | TyF64 => 3, // add F128 handling here
}
}
pub fn bit_width(&self) -> usize {
match *self {
TyF32 => 32,
TyF64 => 64,
}
}
}
// Bind a type to an associated type: `A=Foo`.