whats missing

This commit is contained in:
Quaternions 2024-08-26 16:03:02 -07:00
parent da5decb2f7
commit f12ab4a3c3

View File

@ -3,7 +3,7 @@ use bnum::BInt;
use typenum::{Sum,Unsigned};
use std::marker::PhantomData;
#[derive(Clone,Copy,Debug)]
#[derive(Clone,Copy,Debug,Hash)]
pub struct Fixed<const CHUNKS:usize,Frac>{
bits:BInt<{CHUNKS}>,
frac:PhantomData<Frac>,
@ -28,6 +28,16 @@ impl<const CHUNKS:usize,Frac> PartialEq for Fixed<CHUNKS,Frac>{
}
impl<const CHUNKS:usize,Frac> Eq for Fixed<CHUNKS,Frac>{}
impl<const CHUNKS:usize,Frac> std::ops::Neg for Fixed<CHUNKS,Frac>{
type Output=Self;
fn neg(self)->Self{
Self{
bits:self.bits.neg(),
frac:PhantomData,
}
}
}
macro_rules! impl_operator {
( $struct: ident, $trait: ident, $method: ident, $output: ty ) => {
impl<const CHUNKS:usize,Frac> core::ops::$trait<$struct<CHUNKS,Frac>> for $struct<CHUNKS,Frac>{