Add 0..=isize::MAX range metadata to size loads from vtables

This commit is contained in:
Erik Desjardins
2022-12-08 01:30:07 -05:00
parent 023b5136b5
commit a99e97af97
5 changed files with 79 additions and 3 deletions

View File

@@ -775,6 +775,18 @@ impl Integer {
}
}
/// Returns the largest signed value that can be represented by this Integer.
#[inline]
pub fn signed_max(self) -> i128 {
match self {
I8 => i8::MAX as i128,
I16 => i16::MAX as i128,
I32 => i32::MAX as i128,
I64 => i64::MAX as i128,
I128 => i128::MAX,
}
}
/// Finds the smallest Integer type which can represent the signed value.
#[inline]
pub fn fit_signed(x: i128) -> Integer {