diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index c0751e1..37253a7 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -493,6 +493,10 @@ macro_repeated!( (1,15) ); +pub trait Fix{ + fn fix(self)->Out; +} + macro_rules! impl_fix_rhs_lt_lhs_not_const_generic{ ( (), @@ -507,6 +511,13 @@ macro_rules! impl_fix_rhs_lt_lhs_not_const_generic{ } } } + impl Fix> for Fixed<$lhs,{$lhs*32}>{ + fn fix(self)->Fixed<$rhs,{$rhs*32}>{ + paste::item!{ + self.[]() + } + } + } } } macro_rules! impl_fix_lhs_lt_rhs_not_const_generic{ @@ -523,6 +534,13 @@ macro_rules! impl_fix_lhs_lt_rhs_not_const_generic{ } } } + impl Fix> for Fixed<$lhs,{$lhs*32}>{ + fn fix(self)->Fixed<$rhs,{$rhs*32}>{ + paste::item!{ + self.[]() + } + } + } } } macro_rules! impl_fix_lhs_eq_rhs_not_const_generic{ @@ -539,6 +557,13 @@ macro_rules! impl_fix_lhs_eq_rhs_not_const_generic{ } } } + impl Fix> for Fixed<$lhs,{$lhs*32}>{ + fn fix(self)->Fixed<$rhs,{$rhs*32}>{ + paste::item!{ + self.[]() + } + } + } } }