From f12ab4a3c3b93fb0ec9446af07a77b6db88d37fc Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 26 Aug 2024 16:03:02 -0700 Subject: [PATCH] whats missing --- fixed_wide/src/wide.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fixed_wide/src/wide.rs b/fixed_wide/src/wide.rs index 7944395..7b2db63 100644 --- a/fixed_wide/src/wide.rs +++ b/fixed_wide/src/wide.rs @@ -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{ bits:BInt<{CHUNKS}>, frac:PhantomData, @@ -28,6 +28,16 @@ impl PartialEq for Fixed{ } impl Eq for Fixed{} +impl std::ops::Neg for Fixed{ + 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 core::ops::$trait<$struct> for $struct{