IT++ Logo Newcom Logo

fixed.h

Go to the documentation of this file.
00001 
00033 #ifndef FIXED_H
00034 #define FIXED_H
00035 
00036 #include <itpp/fixedpoint/fix.h>
00037 
00038 
00039 namespace itpp {
00040 
00043 
00049   template<int w, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN>
00050   class Fixed : public Fix {
00051   public:
00053     Fixed(double x=0.0, int s=0, Stat *ptr=0)
00054       : Fix(x, s, w, e, o, q, ptr) {}
00056     explicit Fixed(Stat *ptr)
00057       : Fix(0.0, 0, w, e, o, q, ptr) {}
00059     Fixed(const Fix &x, Stat *ptr=0)
00060       : Fix(x, w, e, o, q, ptr) {}
00062     virtual ~Fixed() {}
00063 
00065     Fixed& operator=(const Fix &x)
00066     {
00067       shift = x.shift;
00068       re = apply_o_mode(x.re);
00069       return *this;
00070     }
00072     Fixed& operator=(int x)
00073     {
00074       shift = 0;
00075       re = apply_o_mode(x);
00076       return *this;
00077     }
00078   protected:
00079   };
00080 
00082 
00083   // Typedefs for Fixed
00084   typedef Fixed<1, TC, WRAP> fixed1;
00085   typedef Fixed<2, TC, WRAP> fixed2;
00086   typedef Fixed<3, TC, WRAP> fixed3;
00087   typedef Fixed<4, TC, WRAP> fixed4;
00088   typedef Fixed<5, TC, WRAP> fixed5;
00089   typedef Fixed<6, TC, WRAP> fixed6;
00090   typedef Fixed<7, TC, WRAP> fixed7;
00091   typedef Fixed<8, TC, WRAP> fixed8;
00092   typedef Fixed<9, TC, WRAP> fixed9;
00093   typedef Fixed<10, TC, WRAP> fixed10;
00094   typedef Fixed<11, TC, WRAP> fixed11;
00095   typedef Fixed<12, TC, WRAP> fixed12;
00096   typedef Fixed<13, TC, WRAP> fixed13;
00097   typedef Fixed<14, TC, WRAP> fixed14;
00098   typedef Fixed<15, TC, WRAP> fixed15;
00099   typedef Fixed<16, TC, WRAP> fixed16;
00100   typedef Fixed<17, TC, WRAP> fixed17;
00101   typedef Fixed<18, TC, WRAP> fixed18;
00102   typedef Fixed<19, TC, WRAP> fixed19;
00103   typedef Fixed<20, TC, WRAP> fixed20;
00104   typedef Fixed<21, TC, WRAP> fixed21;
00105   typedef Fixed<22, TC, WRAP> fixed22;
00106   typedef Fixed<23, TC, WRAP> fixed23;
00107   typedef Fixed<24, TC, WRAP> fixed24;
00108   typedef Fixed<25, TC, WRAP> fixed25;
00109   typedef Fixed<26, TC, WRAP> fixed26;
00110   typedef Fixed<27, TC, WRAP> fixed27;
00111   typedef Fixed<28, TC, WRAP> fixed28;
00112   typedef Fixed<29, TC, WRAP> fixed29;
00113   typedef Fixed<30, TC, WRAP> fixed30;
00114   typedef Fixed<31, TC, WRAP> fixed31;
00115   typedef Fixed<32, TC, WRAP> fixed32;
00116   typedef Fixed<33, TC, WRAP> fixed33;
00117   typedef Fixed<34, TC, WRAP> fixed34;
00118   typedef Fixed<35, TC, WRAP> fixed35;
00119   typedef Fixed<36, TC, WRAP> fixed36;
00120   typedef Fixed<37, TC, WRAP> fixed37;
00121   typedef Fixed<38, TC, WRAP> fixed38;
00122   typedef Fixed<39, TC, WRAP> fixed39;
00123   typedef Fixed<40, TC, WRAP> fixed40;
00124   typedef Fixed<41, TC, WRAP> fixed41;
00125   typedef Fixed<42, TC, WRAP> fixed42;
00126   typedef Fixed<43, TC, WRAP> fixed43;
00127   typedef Fixed<44, TC, WRAP> fixed44;
00128   typedef Fixed<45, TC, WRAP> fixed45;
00129   typedef Fixed<46, TC, WRAP> fixed46;
00130   typedef Fixed<47, TC, WRAP> fixed47;
00131   typedef Fixed<48, TC, WRAP> fixed48;
00132   typedef Fixed<49, TC, WRAP> fixed49;
00133   typedef Fixed<50, TC, WRAP> fixed50;
00134   typedef Fixed<51, TC, WRAP> fixed51;
00135   typedef Fixed<52, TC, WRAP> fixed52;
00136   typedef Fixed<53, TC, WRAP> fixed53;
00137   typedef Fixed<54, TC, WRAP> fixed54;
00138   typedef Fixed<55, TC, WRAP> fixed55;
00139   typedef Fixed<56, TC, WRAP> fixed56;
00140   typedef Fixed<57, TC, WRAP> fixed57;
00141   typedef Fixed<58, TC, WRAP> fixed58;
00142   typedef Fixed<59, TC, WRAP> fixed59;
00143   typedef Fixed<60, TC, WRAP> fixed60;
00144   typedef Fixed<61, TC, WRAP> fixed61;
00145   typedef Fixed<62, TC, WRAP> fixed62;
00146   typedef Fixed<63, TC, WRAP> fixed63;
00147   typedef Fixed<64, TC, WRAP> fixed64;
00148 
00149   // Typedefs for unsigned Fixed
00150   typedef Fixed<1, US, WRAP> ufixed1;
00151   typedef Fixed<2, US, WRAP> ufixed2;
00152   typedef Fixed<3, US, WRAP> ufixed3;
00153   typedef Fixed<4, US, WRAP> ufixed4;
00154   typedef Fixed<5, US, WRAP> ufixed5;
00155   typedef Fixed<6, US, WRAP> ufixed6;
00156   typedef Fixed<7, US, WRAP> ufixed7;
00157   typedef Fixed<8, US, WRAP> ufixed8;
00158   typedef Fixed<9, US, WRAP> ufixed9;
00159   typedef Fixed<10, US, WRAP> ufixed10;
00160   typedef Fixed<11, US, WRAP> ufixed11;
00161   typedef Fixed<12, US, WRAP> ufixed12;
00162   typedef Fixed<13, US, WRAP> ufixed13;
00163   typedef Fixed<14, US, WRAP> ufixed14;
00164   typedef Fixed<15, US, WRAP> ufixed15;
00165   typedef Fixed<16, US, WRAP> ufixed16;
00166   typedef Fixed<17, US, WRAP> ufixed17;
00167   typedef Fixed<18, US, WRAP> ufixed18;
00168   typedef Fixed<19, US, WRAP> ufixed19;
00169   typedef Fixed<20, US, WRAP> ufixed20;
00170   typedef Fixed<21, US, WRAP> ufixed21;
00171   typedef Fixed<22, US, WRAP> ufixed22;
00172   typedef Fixed<23, US, WRAP> ufixed23;
00173   typedef Fixed<24, US, WRAP> ufixed24;
00174   typedef Fixed<25, US, WRAP> ufixed25;
00175   typedef Fixed<26, US, WRAP> ufixed26;
00176   typedef Fixed<27, US, WRAP> ufixed27;
00177   typedef Fixed<28, US, WRAP> ufixed28;
00178   typedef Fixed<29, US, WRAP> ufixed29;
00179   typedef Fixed<30, US, WRAP> ufixed30;
00180   typedef Fixed<31, US, WRAP> ufixed31;
00181   typedef Fixed<32, US, WRAP> ufixed32;
00182   typedef Fixed<33, US, WRAP> ufixed33;
00183   typedef Fixed<34, US, WRAP> ufixed34;
00184   typedef Fixed<35, US, WRAP> ufixed35;
00185   typedef Fixed<36, US, WRAP> ufixed36;
00186   typedef Fixed<37, US, WRAP> ufixed37;
00187   typedef Fixed<38, US, WRAP> ufixed38;
00188   typedef Fixed<39, US, WRAP> ufixed39;
00189   typedef Fixed<40, US, WRAP> ufixed40;
00190   typedef Fixed<41, US, WRAP> ufixed41;
00191   typedef Fixed<42, US, WRAP> ufixed42;
00192   typedef Fixed<43, US, WRAP> ufixed43;
00193   typedef Fixed<44, US, WRAP> ufixed44;
00194   typedef Fixed<45, US, WRAP> ufixed45;
00195   typedef Fixed<46, US, WRAP> ufixed46;
00196   typedef Fixed<47, US, WRAP> ufixed47;
00197   typedef Fixed<48, US, WRAP> ufixed48;
00198   typedef Fixed<49, US, WRAP> ufixed49;
00199   typedef Fixed<50, US, WRAP> ufixed50;
00200   typedef Fixed<51, US, WRAP> ufixed51;
00201   typedef Fixed<52, US, WRAP> ufixed52;
00202   typedef Fixed<53, US, WRAP> ufixed53;
00203   typedef Fixed<54, US, WRAP> ufixed54;
00204   typedef Fixed<55, US, WRAP> ufixed55;
00205   typedef Fixed<56, US, WRAP> ufixed56;
00206   typedef Fixed<57, US, WRAP> ufixed57;
00207   typedef Fixed<58, US, WRAP> ufixed58;
00208   typedef Fixed<59, US, WRAP> ufixed59;
00209   typedef Fixed<60, US, WRAP> ufixed60;
00210   typedef Fixed<61, US, WRAP> ufixed61;
00211   typedef Fixed<62, US, WRAP> ufixed62;
00212   typedef Fixed<63, US, WRAP> ufixed63;
00213   typedef Fixed<64, US, WRAP> ufixed64;
00214 
00215   // Typedefs for saturated Fixed
00216   typedef Fixed<1, TC, SAT> sfixed1;
00217   typedef Fixed<2, TC, SAT> sfixed2;
00218   typedef Fixed<3, TC, SAT> sfixed3;
00219   typedef Fixed<4, TC, SAT> sfixed4;
00220   typedef Fixed<5, TC, SAT> sfixed5;
00221   typedef Fixed<6, TC, SAT> sfixed6;
00222   typedef Fixed<7, TC, SAT> sfixed7;
00223   typedef Fixed<8, TC, SAT> sfixed8;
00224   typedef Fixed<9, TC, SAT> sfixed9;
00225   typedef Fixed<10, TC, SAT> sfixed10;
00226   typedef Fixed<11, TC, SAT> sfixed11;
00227   typedef Fixed<12, TC, SAT> sfixed12;
00228   typedef Fixed<13, TC, SAT> sfixed13;
00229   typedef Fixed<14, TC, SAT> sfixed14;
00230   typedef Fixed<15, TC, SAT> sfixed15;
00231   typedef Fixed<16, TC, SAT> sfixed16;
00232   typedef Fixed<17, TC, SAT> sfixed17;
00233   typedef Fixed<18, TC, SAT> sfixed18;
00234   typedef Fixed<19, TC, SAT> sfixed19;
00235   typedef Fixed<20, TC, SAT> sfixed20;
00236   typedef Fixed<21, TC, SAT> sfixed21;
00237   typedef Fixed<22, TC, SAT> sfixed22;
00238   typedef Fixed<23, TC, SAT> sfixed23;
00239   typedef Fixed<24, TC, SAT> sfixed24;
00240   typedef Fixed<25, TC, SAT> sfixed25;
00241   typedef Fixed<26, TC, SAT> sfixed26;
00242   typedef Fixed<27, TC, SAT> sfixed27;
00243   typedef Fixed<28, TC, SAT> sfixed28;
00244   typedef Fixed<29, TC, SAT> sfixed29;
00245   typedef Fixed<30, TC, SAT> sfixed30;
00246   typedef Fixed<31, TC, SAT> sfixed31;
00247   typedef Fixed<32, TC, SAT> sfixed32;
00248   typedef Fixed<33, TC, SAT> sfixed33;
00249   typedef Fixed<34, TC, SAT> sfixed34;
00250   typedef Fixed<35, TC, SAT> sfixed35;
00251   typedef Fixed<36, TC, SAT> sfixed36;
00252   typedef Fixed<37, TC, SAT> sfixed37;
00253   typedef Fixed<38, TC, SAT> sfixed38;
00254   typedef Fixed<39, TC, SAT> sfixed39;
00255   typedef Fixed<40, TC, SAT> sfixed40;
00256   typedef Fixed<41, TC, SAT> sfixed41;
00257   typedef Fixed<42, TC, SAT> sfixed42;
00258   typedef Fixed<43, TC, SAT> sfixed43;
00259   typedef Fixed<44, TC, SAT> sfixed44;
00260   typedef Fixed<45, TC, SAT> sfixed45;
00261   typedef Fixed<46, TC, SAT> sfixed46;
00262   typedef Fixed<47, TC, SAT> sfixed47;
00263   typedef Fixed<48, TC, SAT> sfixed48;
00264   typedef Fixed<49, TC, SAT> sfixed49;
00265   typedef Fixed<50, TC, SAT> sfixed50;
00266   typedef Fixed<51, TC, SAT> sfixed51;
00267   typedef Fixed<52, TC, SAT> sfixed52;
00268   typedef Fixed<53, TC, SAT> sfixed53;
00269   typedef Fixed<54, TC, SAT> sfixed54;
00270   typedef Fixed<55, TC, SAT> sfixed55;
00271   typedef Fixed<56, TC, SAT> sfixed56;
00272   typedef Fixed<57, TC, SAT> sfixed57;
00273   typedef Fixed<58, TC, SAT> sfixed58;
00274   typedef Fixed<59, TC, SAT> sfixed59;
00275   typedef Fixed<60, TC, SAT> sfixed60;
00276   typedef Fixed<61, TC, SAT> sfixed61;
00277   typedef Fixed<62, TC, SAT> sfixed62;
00278   typedef Fixed<63, TC, SAT> sfixed63;
00279   typedef Fixed<64, TC, SAT> sfixed64;
00280 
00281   // Typedefs for saturated unsigned Fixed
00282   typedef Fixed<1, US, SAT> sufixed1;
00283   typedef Fixed<2, US, SAT> sufixed2;
00284   typedef Fixed<3, US, SAT> sufixed3;
00285   typedef Fixed<4, US, SAT> sufixed4;
00286   typedef Fixed<5, US, SAT> sufixed5;
00287   typedef Fixed<6, US, SAT> sufixed6;
00288   typedef Fixed<7, US, SAT> sufixed7;
00289   typedef Fixed<8, US, SAT> sufixed8;
00290   typedef Fixed<9, US, SAT> sufixed9;
00291   typedef Fixed<10, US, SAT> sufixed10;
00292   typedef Fixed<11, US, SAT> sufixed11;
00293   typedef Fixed<12, US, SAT> sufixed12;
00294   typedef Fixed<13, US, SAT> sufixed13;
00295   typedef Fixed<14, US, SAT> sufixed14;
00296   typedef Fixed<15, US, SAT> sufixed15;
00297   typedef Fixed<16, US, SAT> sufixed16;
00298   typedef Fixed<17, US, SAT> sufixed17;
00299   typedef Fixed<18, US, SAT> sufixed18;
00300   typedef Fixed<19, US, SAT> sufixed19;
00301   typedef Fixed<20, US, SAT> sufixed20;
00302   typedef Fixed<21, US, SAT> sufixed21;
00303   typedef Fixed<22, US, SAT> sufixed22;
00304   typedef Fixed<23, US, SAT> sufixed23;
00305   typedef Fixed<24, US, SAT> sufixed24;
00306   typedef Fixed<25, US, SAT> sufixed25;
00307   typedef Fixed<26, US, SAT> sufixed26;
00308   typedef Fixed<27, US, SAT> sufixed27;
00309   typedef Fixed<28, US, SAT> sufixed28;
00310   typedef Fixed<29, US, SAT> sufixed29;
00311   typedef Fixed<30, US, SAT> sufixed30;
00312   typedef Fixed<31, US, SAT> sufixed31;
00313   typedef Fixed<32, US, SAT> sufixed32;
00314   typedef Fixed<33, US, SAT> sufixed33;
00315   typedef Fixed<34, US, SAT> sufixed34;
00316   typedef Fixed<35, US, SAT> sufixed35;
00317   typedef Fixed<36, US, SAT> sufixed36;
00318   typedef Fixed<37, US, SAT> sufixed37;
00319   typedef Fixed<38, US, SAT> sufixed38;
00320   typedef Fixed<39, US, SAT> sufixed39;
00321   typedef Fixed<40, US, SAT> sufixed40;
00322   typedef Fixed<41, US, SAT> sufixed41;
00323   typedef Fixed<42, US, SAT> sufixed42;
00324   typedef Fixed<43, US, SAT> sufixed43;
00325   typedef Fixed<44, US, SAT> sufixed44;
00326   typedef Fixed<45, US, SAT> sufixed45;
00327   typedef Fixed<46, US, SAT> sufixed46;
00328   typedef Fixed<47, US, SAT> sufixed47;
00329   typedef Fixed<48, US, SAT> sufixed48;
00330   typedef Fixed<49, US, SAT> sufixed49;
00331   typedef Fixed<50, US, SAT> sufixed50;
00332   typedef Fixed<51, US, SAT> sufixed51;
00333   typedef Fixed<52, US, SAT> sufixed52;
00334   typedef Fixed<53, US, SAT> sufixed53;
00335   typedef Fixed<54, US, SAT> sufixed54;
00336   typedef Fixed<55, US, SAT> sufixed55;
00337   typedef Fixed<56, US, SAT> sufixed56;
00338   typedef Fixed<57, US, SAT> sufixed57;
00339   typedef Fixed<58, US, SAT> sufixed58;
00340   typedef Fixed<59, US, SAT> sufixed59;
00341   typedef Fixed<60, US, SAT> sufixed60;
00342   typedef Fixed<61, US, SAT> sufixed61;
00343   typedef Fixed<62, US, SAT> sufixed62;
00344   typedef Fixed<63, US, SAT> sufixed63;
00345   typedef Fixed<64, US, SAT> sufixed64;
00346 
00347 #ifndef _MSC_VER
00348   // Template instantiations
00349   extern template class Fixed<64, TC, WRAP>;
00350 #endif
00351 } // namespace itpp
00352 
00353 #endif // #ifndef FIXED_H
SourceForge Logo

Generated on Fri Jun 8 00:27:17 2007 for IT++ by Doxygen 1.5.2