ScalarInt: add methods to assert being a (u)int of given size

This commit is contained in:
Ralf Jung 2024-04-18 08:38:37 +02:00
parent 5e6184cdb7
commit 42220f0930
13 changed files with 78 additions and 72 deletions

View file

@ -249,7 +249,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> {
}
/// Return the immediate as a `ScalarInt`. Ensures that it has the size that the layout of the
/// immediate indcates.
/// immediate indicates.
#[inline]
pub fn to_scalar_int(&self) -> InterpResult<'tcx, ScalarInt> {
let s = self.to_scalar().to_scalar_int()?;