IT++ Logo
fixed.h
Go to the documentation of this file.
1
29#ifndef FIXED_H
30#define FIXED_H
31
32#include <itpp/fixed/fix.h>
33#include <itpp/itexports.h>
34
35
36namespace itpp
37{
38
41
47template < int w, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN >
48class Fixed : public Fix
49{
50public:
52 Fixed(double x = 0.0, int s = 0, Stat *ptr = 0)
53 : Fix(x, s, w, e, o, q, ptr) {}
55 explicit Fixed(Stat *ptr)
56 : Fix(0.0, 0, w, e, o, q, ptr) {}
58 Fixed(const Fix &x, Stat *ptr = 0)
59 : Fix(x, w, e, o, q, ptr) {}
61 virtual ~Fixed() {}
62
64 Fixed& operator=(const Fix &x) {
65 shift = x.shift;
66 re = apply_o_mode(x.re);
67 return *this;
68 }
70 Fixed& operator=(int x) {
71 shift = 0;
72 re = apply_o_mode(x);
73 return *this;
74 }
75protected:
76};
77
79
147
215
283
350
351// ----------------------------------------------------------------------
352// Instantiations
353// ----------------------------------------------------------------------
354
356
358
359} // namespace itpp
360
361#endif // #ifndef FIXED_H
General array class.
Definition array.h:105
fixrep apply_o_mode(fixrep x) const
Handle overflows using overflow mode omode and make call to statistics object (if any)
Definition fix_base.cpp:88
int shift
Accumulated bitshift (positive means left-shifted, negative means right-shifted)
Definition fix_base.h:1021
Fixed-point data type.
Definition fix.h:52
fixrep re
Data representation.
Definition fix.h:137
Templated fixed-point data type.
Definition fixed.h:49
Fixed(const Fix &x, Stat *ptr=0)
Constructor.
Definition fixed.h:58
virtual ~Fixed()
Destructor.
Definition fixed.h:61
Fixed & operator=(int x)
Assignment from int.
Definition fixed.h:70
Fixed & operator=(const Fix &x)
Assignment from Fix.
Definition fixed.h:64
Fixed(Stat *ptr)
Constructor.
Definition fixed.h:55
Fixed(double x=0.0, int s=0, Stat *ptr=0)
Default constructor.
Definition fixed.h:52
A class for sampling a signal and calculating statistics.
Definition misc_stat.h:49
Definitions of a fixed-point data type Fix.
itpp namespace
Definition itmex.h:37
Fixed< 1, TC, SAT > sfixed1
Typedefs for saturated Fixed (sfixed1, sfixed2, ..., sfixed64)
Definition fixed.h:217
Fixed< 1, TC, WRAP > fixed1
Typedefs for Fixed (fixed1, fixed2, ..., fixed64)
Definition fixed.h:81
Fixed< 1, US, WRAP > ufixed1
Typedefs for unsigned Fixed (ufixed1, ufixed2, ..., ufixed64)
Definition fixed.h:149
Fixed< 1, US, SAT > sufixed1
Typedefs for saturated unsigned Fixed (sufixed1, sufixed2, ..., sufixed64)
Definition fixed.h:285

Generated on Tue Mar 26 2024 19:08:31 for IT++ by Doxygen 1.9.8