fixed: constants
This commit is contained in:
parent
60753490c6
commit
20a317612e
@ -8,6 +8,12 @@ pub struct Fixed<const CHUNKS:usize,Frac>{
|
|||||||
pub(crate)frac:PhantomData<Frac>,
|
pub(crate)frac:PhantomData<Frac>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>{
|
||||||
|
pub const ZERO:Self=Self{bits:BInt::<CHUNKS>::ZERO,frac:PhantomData};
|
||||||
|
pub const ONE:Self=Self{bits:BInt::<CHUNKS>::ONE.shl(Frac::U32),frac:PhantomData};
|
||||||
|
pub const NEG_ONE:Self=Self{bits:BInt::<CHUNKS>::NEG_ONE.shl(Frac::U32),frac:PhantomData};
|
||||||
|
}
|
||||||
|
|
||||||
impl<const CHUNKS:usize,FracDst:Unsigned,T> From<T> for Fixed<CHUNKS,FracDst>
|
impl<const CHUNKS:usize,FracDst:Unsigned,T> From<T> for Fixed<CHUNKS,FracDst>
|
||||||
where
|
where
|
||||||
BInt<CHUNKS>:From<T>
|
BInt<CHUNKS>:From<T>
|
||||||
|
Loading…
Reference in New Issue
Block a user