#include <Filters/FixedPoint.hpp>
Very basic fixed-point integer implementation.
| T | The integer type to use. |
| N | The number of fractional bits. |
| T2 | The integer type to use for intermediate values when mutliplying or dividing. |
Definition at line 64 of file FixedPoint.hpp.
Collaboration diagram for FixedPoint< T, N, T2 >:Public Member Functions | |
| FixedPoint () | |
| Default constructor. More... | |
| template<class U > | |
| FixedPoint (U f) | |
| Initialize U from a numeric value. More... | |
| FixedPoint | operator+ (FixedPoint rhs) const |
| Addition. More... | |
| FixedPoint | operator- (FixedPoint rhs) const |
| Subtraction. More... | |
| FixedPoint | operator- () const |
| Invert. More... | |
| FixedPoint | operator* (FixedPoint rhs) const |
| Multiplication. More... | |
| T2 | operator* (T2 rhs) const |
| Multiplication with normal integer. More... | |
| FixedPoint | operator/ (FixedPoint rhs) const |
| Division. More... | |
| operator long double () const | |
| operator double () const | |
| operator float () const | |
Static Public Member Functions | |
| static constexpr FixedPoint | raw (T t) |
| Convert a raw integer representation to fixed point type. More... | |
| static T | div_N (T2 val) |
| Divide the given integer by \( 2^N \). More... | |
Static Public Attributes | |
| static constexpr T | one = 1 << N |
| Fixed-point representation of the number one. More... | |
Private Attributes | |
| T | val |
|
inline |
Default constructor.
Definition at line 70 of file FixedPoint.hpp.
|
inline |
Initialize U from a numeric value.
Definition at line 74 of file FixedPoint.hpp.
|
inlinestaticconstexpr |
Convert a raw integer representation to fixed point type.
Definition at line 77 of file FixedPoint.hpp.
|
inline |
Addition.
Definition at line 84 of file FixedPoint.hpp.
|
inline |
Subtraction.
Definition at line 101 of file FixedPoint.hpp.
|
inline |
Invert.
Definition at line 107 of file FixedPoint.hpp.
|
inline |
Multiplication.
Definition at line 110 of file FixedPoint.hpp.
|
inline |
Multiplication with normal integer.
Definition at line 115 of file FixedPoint.hpp.
|
inline |
Division.
Definition at line 118 of file FixedPoint.hpp.
|
inlinestatic |
Divide the given integer by \( 2^N \).
Definition at line 125 of file FixedPoint.hpp.
|
inlineexplicit |
Definition at line 132 of file FixedPoint.hpp.
|
inlineexplicit |
Definition at line 133 of file FixedPoint.hpp.
|
inlineexplicit |
Definition at line 134 of file FixedPoint.hpp.
|
staticconstexpr |
Fixed-point representation of the number one.
Definition at line 67 of file FixedPoint.hpp.
|
private |
Definition at line 137 of file FixedPoint.hpp.