inline const functions
This commit is contained in:
parent
0924518922
commit
78f860c672
@ -21,15 +21,18 @@ impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>{
|
|||||||
pub const NEG_HALF:Self=Self::from_bits(BInt::<CHUNKS>::NEG_ONE.shl(Frac::U32-1));
|
pub const NEG_HALF:Self=Self::from_bits(BInt::<CHUNKS>::NEG_ONE.shl(Frac::U32-1));
|
||||||
}
|
}
|
||||||
impl<const CHUNKS:usize,Frac> Fixed<CHUNKS,Frac>{
|
impl<const CHUNKS:usize,Frac> Fixed<CHUNKS,Frac>{
|
||||||
|
#[inline]
|
||||||
pub const fn from_bits(bits:BInt::<CHUNKS>)->Self{
|
pub const fn from_bits(bits:BInt::<CHUNKS>)->Self{
|
||||||
Self{
|
Self{
|
||||||
bits,
|
bits,
|
||||||
frac:std::marker::PhantomData,
|
frac:std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub const fn to_bits(self)->BInt<CHUNKS>{
|
pub const fn to_bits(self)->BInt<CHUNKS>{
|
||||||
self.bits
|
self.bits
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub const fn raw(value:i64)->Self{
|
pub const fn raw(value:i64)->Self{
|
||||||
Self::from_bits(BInt::from_bits(bnum::BUint::from_digit(value as u64)))
|
Self::from_bits(BInt::from_bits(bnum::BUint::from_digit(value as u64)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user