const helpers
This commit is contained in:
parent
db5c37c2fb
commit
6cb639317c
@ -40,6 +40,22 @@ impl<const N:usize,const F:usize> Fixed<N,F>{
|
|||||||
digits[N-1]|=(value&i64::MIN) as u64;
|
digits[N-1]|=(value&i64::MIN) as u64;
|
||||||
Self::from_bits(BInt::from_bits(bnum::BUint::from_digits(digits)))
|
Self::from_bits(BInt::from_bits(bnum::BUint::from_digits(digits)))
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
pub const fn is_zero(self)->bool{
|
||||||
|
self.bits.is_zero()
|
||||||
|
}
|
||||||
|
#[inline]
|
||||||
|
pub const fn is_negative(self)->bool{
|
||||||
|
self.bits.is_negative()
|
||||||
|
}
|
||||||
|
#[inline]
|
||||||
|
pub const fn is_positive(self)->bool{
|
||||||
|
self.bits.is_positive()
|
||||||
|
}
|
||||||
|
#[inline]
|
||||||
|
pub const fn abs(self)->Self{
|
||||||
|
Self::from_bits(self.bits.abs())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl<const F:usize> Fixed<1,F>{
|
impl<const F:usize> Fixed<1,F>{
|
||||||
/// My old code called this function everywhere so let's provide it
|
/// My old code called this function everywhere so let's provide it
|
||||||
|
Loading…
Reference in New Issue
Block a user