remove unneeded functions
This commit is contained in:
parent
5d543fef64
commit
91a4173669
|
@ -1537,10 +1537,10 @@ assert_eq!(Fix::saturating_from_float(f64::NEG_INFINITY), Fix::min_value());
|
||||||
if val.is_nan() {
|
if val.is_nan() {
|
||||||
panic!("NaN");
|
panic!("NaN");
|
||||||
}
|
}
|
||||||
let saturated = if val.is_sign_positive() {
|
let saturated = if val.is_sign_negative() {
|
||||||
Self::max_value()
|
|
||||||
} else {
|
|
||||||
Self::min_value()
|
Self::min_value()
|
||||||
|
} else {
|
||||||
|
Self::max_value()
|
||||||
};
|
};
|
||||||
if !val.is_finite() {
|
if !val.is_finite() {
|
||||||
return saturated;
|
return saturated;
|
||||||
|
|
|
@ -34,7 +34,6 @@ pub trait SealedFloat: Copy + Debug + Display {
|
||||||
fn is_nan(self) -> bool;
|
fn is_nan(self) -> bool;
|
||||||
fn is_finite(self) -> bool;
|
fn is_finite(self) -> bool;
|
||||||
fn is_zero(self) -> bool;
|
fn is_zero(self) -> bool;
|
||||||
fn is_sign_positive(self) -> bool;
|
|
||||||
fn is_sign_negative(self) -> bool;
|
fn is_sign_negative(self) -> bool;
|
||||||
|
|
||||||
fn parts(self) -> (bool, i32, Self::Bits);
|
fn parts(self) -> (bool, i32, Self::Bits);
|
||||||
|
@ -80,11 +79,6 @@ macro_rules! sealed_float {
|
||||||
(self.to_bits() & !Self::SIGN_MASK) == 0
|
(self.to_bits() & !Self::SIGN_MASK) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn is_sign_positive(self) -> bool {
|
|
||||||
(self.to_bits() & Self::SIGN_MASK) == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_sign_negative(self) -> bool {
|
fn is_sign_negative(self) -> bool {
|
||||||
(self.to_bits() & Self::SIGN_MASK) != 0
|
(self.to_bits() & Self::SIGN_MASK) != 0
|
||||||
|
|
|
@ -29,7 +29,6 @@ pub trait SealedInt: Copy + Ord + Debug + Display {
|
||||||
fn one_shl(shift: u32) -> Self;
|
fn one_shl(shift: u32) -> Self;
|
||||||
fn all_ones_shl(shift: u32) -> Self;
|
fn all_ones_shl(shift: u32) -> Self;
|
||||||
fn is_zero(self) -> bool;
|
fn is_zero(self) -> bool;
|
||||||
fn is_positive(self) -> bool;
|
|
||||||
fn is_negative(self) -> bool;
|
fn is_negative(self) -> bool;
|
||||||
|
|
||||||
fn to_fixed_overflow(
|
fn to_fixed_overflow(
|
||||||
|
@ -67,11 +66,6 @@ macro_rules! sealed_int {
|
||||||
self == 0
|
self == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn is_positive(self) -> bool {
|
|
||||||
self > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
$($rest)*
|
$($rest)*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -221,11 +215,6 @@ impl SealedInt for bool {
|
||||||
!self
|
!self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn is_positive(self) -> bool {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_negative(self) -> bool {
|
fn is_negative(self) -> bool {
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in New Issue