Use the destination type size instead of the source type size

This commit is contained in:
Oliver Schneider 2018-05-22 16:18:43 +02:00
parent edbdf3d263
commit 1550fd212b

View File

@ -21,7 +21,7 @@ pub(super) fn cast_primval(
Scalar::Bits { defined: 0, .. } => Ok(val),
Scalar::Ptr(ptr) => self.cast_from_ptr(ptr, dest_ty),
Scalar::Bits { bits, .. } => {
// TODO(oli-obk): impl scalar_size for floats and check defined bits here
// TODO(oli-obk): check defined bits here
match src_ty.sty {
TyFloat(fty) => self.cast_from_float(bits, fty, dest_ty),
_ => self.cast_from_int(bits, src_ty, dest_ty),