diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-07-24 10:19:20 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-07-29 14:08:15 +0000 |
| commit | 75bdbf25e39f073b35eadedcf575affac7762a86 (patch) | |
| tree | dda912558bb387a3f3462b05fff7a3d1872b6cd5 /compiler/rustc_abi/src/lib.rs | |
| parent | 45b0c8d03e627d55f814a4cd03b90c5068664ac8 (diff) | |
| download | rust-75bdbf25e39f073b35eadedcf575affac7762a86.tar.gz rust-75bdbf25e39f073b35eadedcf575affac7762a86.zip | |
Pick the largest niche even if the largest niche is wrapped around
Diffstat (limited to 'compiler/rustc_abi/src/lib.rs')
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e346706877..14e256b8045 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1205,6 +1205,19 @@ impl Integer { } } + /// Returns the smallest signed value that can be represented by this Integer. + #[inline] + pub fn signed_min(self) -> i128 { + use Integer::*; + match self { + I8 => i8::MIN as i128, + I16 => i16::MIN as i128, + I32 => i32::MIN as i128, + I64 => i64::MIN as i128, + I128 => i128::MIN, + } + } + /// Finds the smallest Integer type which can represent the signed value. #[inline] pub fn fit_signed(x: i128) -> Integer { |
