interpret: simplify pointer arithmetic logic

This commit is contained in:
Ralf Jung 2024-08-01 10:19:13 +02:00
parent de78cb56b2
commit 5d5c97aad7
27 changed files with 73 additions and 187 deletions

View file

@ -560,17 +560,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
self.frame().body
}
#[inline(always)]
pub fn sign_extend(&self, value: u128, ty: TyAndLayout<'_>) -> u128 {
assert!(ty.abi.is_signed());
ty.size.sign_extend(value)
}
#[inline(always)]
pub fn truncate(&self, value: u128, ty: TyAndLayout<'_>) -> u128 {
ty.size.truncate(value)
}
#[inline]
pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
ty.is_freeze(*self.tcx, self.param_env)