1
Fork 0

Rename (un)signed to (un)signed_int

This commit is contained in:
Andreas Liljeqvist 2021-09-07 20:44:33 +02:00
parent 9129f4306f
commit dd34e0c966
6 changed files with 17 additions and 16 deletions

View file

@ -394,17 +394,17 @@ impl Size {
}
#[inline]
pub fn signed_min(&self) -> i128 {
pub fn signed_int_min(&self) -> i128 {
self.sign_extend(1_u128 << (self.bits() - 1)) as i128
}
#[inline]
pub fn signed_max(&self) -> i128 {
pub fn signed_int_max(&self) -> i128 {
i128::MAX >> (128 - self.bits())
}
#[inline]
pub fn unsigned_max(&self) -> u128 {
pub fn unsigned_int_max(&self) -> u128 {
u128::MAX >> (128 - self.bits())
}
}
@ -790,7 +790,7 @@ impl WrappingRange {
/// Returns `true` if `size` completely fills the range.
#[inline]
pub fn is_full_for(&self, size: Size) -> bool {
let max_value = size.unsigned_max();
let max_value = size.unsigned_int_max();
debug_assert!(self.start <= max_value && self.end <= max_value);
(self.start == 0 && self.end == max_value) || (self.end + 1 == self.start)
}
@ -1084,7 +1084,7 @@ impl Niche {
let Scalar { value, valid_range: v } = self.scalar;
let size = value.size(cx);
assert!(size.bits() <= 128);
let max_value = size.unsigned_max();
let max_value = size.unsigned_int_max();
// Find out how many values are outside the valid range.
let niche = v.end.wrapping_add(1)..v.start;
@ -1097,7 +1097,7 @@ impl Niche {
let Scalar { value, valid_range: v } = self.scalar;
let size = value.size(cx);
assert!(size.bits() <= 128);
let max_value = size.unsigned_max();
let max_value = size.unsigned_int_max();
if count > max_value {
return None;