Remove unchecked_shr/shl from intrinsics

This commit is contained in:
Tim 2018-09-06 16:07:13 +02:00
parent 5a8b46d993
commit 055c63ab0d

View File

@ -443,42 +443,6 @@ fn call_intrinsic(
self.write_value(value, dest)?;
}
"unchecked_shl" => {
let bits = dest.layout.size.bytes() as u128 * 8;
let l = self.read_value(args[0])?;
let r = self.read_value(args[1])?;
let rval = r.to_scalar()?.to_bytes()?;
if rval >= bits {
return err!(Intrinsic(
format!("Overflowing shift by {} in unchecked_shl", rval),
));
}
self.binop_ignore_overflow(
mir::BinOp::Shl,
l,
r,
dest,
)?;
}
"unchecked_shr" => {
let bits = dest.layout.size.bytes() as u128 * 8;
let l = self.read_value(args[0])?;
let r = self.read_value(args[1])?;
let rval = r.to_scalar()?.to_bytes()?;
if rval >= bits {
return err!(Intrinsic(
format!("Overflowing shift by {} in unchecked_shr", rval),
));
}
self.binop_ignore_overflow(
mir::BinOp::Shr,
l,
r,
dest,
)?;
}
"unchecked_div" => {
let l = self.read_value(args[0])?;
let r = self.read_value(args[1])?;