Data Structures | |
struct | fixed_storage_type< M, F, s, bool > |
Storage type for a fixed point number. More... | |
struct | fixed_storage_type< M, F, true, test64(M, F, 1)> |
Storage type for a fixed point number representable on int64. More... | |
struct | fixed_storage_type< M, F, false, test64(M, F, 0)> |
Storage type for a fixed point number representable on uint64. More... | |
struct | fixed_storage_type< M, F, true, test32(M, F, 1)> |
Storage type for a fixed point number representable on int32. More... | |
struct | fixed_storage_type< M, F, false, test32(M, F, 0)> |
Storage type for a fixed point number representable on uint32. More... | |
struct | fixed_storage_type< M, F, true, test16(M, F, 1)> |
Storage type for a fixed point number representable on int16. More... | |
struct | fixed_storage_type< M, F, false, test16(M, F, 0)> |
Storage type for a fixed point number representable on uint16. More... | |
struct | fixed_storage_type< M, F, true, test8(M, F, 1)> |
Storage type for a fixed point number representable on int8. More... | |
struct | fixed_storage_type< M, F, false, test8(M, F, 0)> |
Storage type for a fixed point number representable on uint8. More... | |
struct | Q< M, F, S, T > |
Fixed point template. More... | |
struct | Q< M, F, true, int64_t > |
Signed fixed point datatypes on 64 bits. More... | |
struct | Q< M, F, false, uint64_t > |
Unsigned fixed point datatypes on 64 bits. More... | |
struct | Q< M, F, true, int32_t > |
Signed fixed point datatypes on 32 bits. More... | |
struct | Q< M, F, false, uint32_t > |
Unsigned fixed point datatypes on 32 bits. More... | |
struct | Q< M, F, true, int16_t > |
Signed fixed point datatypes on 16 bits. More... | |
struct | Q< M, F, false, uint16_t > |
Unsigned fixed point datatypes on 16 bits. More... | |
struct | Q< M, F, true, int8_t > |
Signed fixed point datatypes on 8 bits. More... | |
struct | Q< M, F, false, uint8_t > |
Unsigned fixed point datatypes on 8 bits. More... | |
struct | FixedCastShift< M, FD, FS, S,(FD >FS)> |
Changed fractional representation of a fixed point number using a shift. More... | |
struct | FixedCastShift< M, FD, FS, S,(FD< FS)> |
Changed fractional representation of a fixed point number using a shift. More... | |
struct | Accumulate< MD, MS, F, S, bool > |
Accumulation without saturation. More... | |
struct | Accumulate< MD, MS, F, S, true > |
Accumulation without saturation. More... | |
Typedefs | |
using | Q63 = Q< 0, 63 > |
Q63 datatype. | |
using | Q31 = Q< 0, 31 > |
Q31 datatype. | |
using | Q15 = Q< 0, 15 > |
Q15 datatype. | |
using | Q7 = Q< 0, 7 > |
Q7 datatype. | |
Functions | |
constexpr bool | test64 (const int M, const int F, const int S) |
Function to identify the template for fixed number representable on 64 bits. | |
constexpr bool | test32 (const int M, const int F, const int S) |
Function to identify the template for fixed number representable on 32 bits. | |
constexpr bool | test16 (const int M, const int F, const int S) |
Function to identify the template for fixed number representable on 16 bits. | |
constexpr bool | test8 (const int M, const int F, const int S) |
Function to identify the template for fixed number representable on 8 bits. | |
constexpr Q63 | operator""_q63 (long double x) |
q63 literal | |
constexpr Q31 | operator""_q31 (long double x) |
q31 literal | |
constexpr Q15 | operator""_q15 (long double x) |
q15 literal | |
constexpr Q7 | operator""_q7 (long double x) |
q7 literal | |
template<int MA, int FA, int MB, int FB, bool SA, bool SB> | |
Q< MA+MB+1, FA+FB, SA||SB > | mult (const Q< MA, FA, SA > &a, const Q< MB, FB, SB > &b) |
Multiplication of two fixed point numbers A and B. | |
template<int M, int F, bool S> | |
Q< M, F, S > | operator+ (const Q< M, F, S > &a, const Q< M, F, S > &b) |
Add two fixed point numbers with saturation. | |
template<int M, int F, bool S> | |
Q< M, F, S > | operator- (const Q< M, F, S > &a, const Q< M, F, S > &b) |
Subtract two fixed point numbers with saturation. | |
template<int M, int F, bool S> | |
Q< M, F, S > | operator- (const Q< M, F, S > &a) |
Negate a fixed point number with saturation. | |
template<int M, int F, bool S> | |
Q< M, F, S > | add (const Q< M, F, S > &a, const Q< M, F, S > &b) |
Add two fixed point numbers without saturation. | |
template<int M, int F, bool S> | |
Q< M, F, S > | sub (const Q< M, F, S > &a, const Q< M, F, S > &b) |
Subtract two fixed point numbers without saturation. | |
template<int M, int F, int N, bool S> | |
Q< M, F, S > | operator>> (const Q< M, F, S > &a, std::integral_constant< int, N >) noexcept |
Shift right a fixed point number with a shift known at build time. | |
template<int M, int F, int N, bool S> | |
Q< M+N, F, S > | operator<< (const Q< M, F, S > &a, std::integral_constant< int, N >) noexcept |
Shift left a fixed point number with a shift known at build time. | |
template<int MD = 0, int MS, int F> | |
Q< MD, F, true > | saturate (const Q< MS, F, true > &src, typename std::enable_if<(MD< MS) &&((MD+F)< 31)>::type *=nullptr) |
Saturate a signed fixed point number. | |
template<int MD = 0, int MS, int F> | |
Q< MD, F, false > | saturate (const Q< MS, F, false > &src, typename std::enable_if<(MD< MS) &&((MD+F)< 31)>::type *=nullptr) |
Saturate an unsigned fixed point number. | |
template<int FD, int M, int FS, bool S> | |
Q< M, FD, S > | toFrac (const Q< M, FS, S > &src) |
Convert between different fractional part formats. | |
template<int MD, int MS, int F, bool S> | |
Q< MD, F, S > | accumulate (const Q< MD, F, S > &a, const Q< MS, F, S > &b) |
Accumulate without saturation. | |
Q7 | operator* (const Q7 &a, const Q7 &b) |
Multiplication operator. | |
Q15 | operator* (const Q15 &a, const Q15 &b) |
Multiplication operator. | |
Q31 | operator* (const Q31 &a, const Q31 &b) |
Multiplication operator. | |
template<int M, int F> | |
bool | operator> (const Q< M, F > &a, const Q< M, F > &b) |
Greater-than comparison operator. | |
template<int M, int F> | |
bool | operator< (const Q< M, F > &a, const Q< M, F > &b) |
Less-than comparison operator. | |
template<int M, int F> | |
bool | operator>= (const Q< M, F > &a, const Q< M, F > &b) |
Greater-than-or-equal comparison operator. | |
template<int M, int F> | |
bool | operator<= (const Q< M, F > &a, const Q< M, F > &b) |
Less-than-or-equal comparison operator. | |
template<int M, int F> | |
bool | operator== (const Q< M, F > a, const Q< M, F > b) |
Equality operator. | |
template<int M, int F> | |
bool | operator!= (const Q< M, F > a, const Q< M, F > b) |
Inequality operator. | |
template<int M, int F, bool S> | |
Q< M, F, S > | operator/ (const Q< M, F, S > a, const int32_t b) |
Division operator. | |
template<int M, int F, bool S> | |
Q< M, F, S > | operator+ (const Q< M, F, S > &a) |
No op operator. | |
struct arm_cmsis_dsp::fixed_storage_type |
Storage type for a fixed point number.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
s | signed or unsigned |
struct arm_cmsis_dsp::fixed_storage_type< M, F, true, test64(M, F, 1)> |
Storage type for a fixed point number representable on int64.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, false, test64(M, F, 0)> |
Storage type for a fixed point number representable on uint64.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, true, test32(M, F, 1)> |
Storage type for a fixed point number representable on int32.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, false, test32(M, F, 0)> |
Storage type for a fixed point number representable on uint32.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, true, test16(M, F, 1)> |
Storage type for a fixed point number representable on int16.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, false, test16(M, F, 0)> |
Storage type for a fixed point number representable on uint16.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, true, test8(M, F, 1)> |
Storage type for a fixed point number representable on int8.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::fixed_storage_type< M, F, false, test8(M, F, 0)> |
Storage type for a fixed point number representable on uint8.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
struct arm_cmsis_dsp::Q |
Fixed point template.
M | Number of bits for mantissa (without sign bit)# |
F | Number of bits for fractional part |
S | Signed or unsigned |
T | storage datatype |
struct arm_cmsis_dsp::Q< M, F, true, int64_t > |
Signed fixed point datatypes on 64 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, true >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, true >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
constexpr | Q (const Q< M, F, false > &other) |
Convert an unsigned fixed point to this fixed point. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Q & | operator-= (const Q other) |
this -= other | |
Static Public Member Functions | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = true |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0x7FFFFFFFFFFFFFFFLL |
Maximum representable positive value. | |
static constexpr value_type | minVal = 0x8000000000000000LL |
Minimum representable negative value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
Convert an unsigned fixed point to this fixed point.
other | The unsigned fixed point number |
Some problem may occur since the unsigned may not be representable with the less bits required for the sign representation. This convertion is not saturating.
|
inlinestaticconstexpr |
Convert a float to fixed point.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
this -= other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
struct arm_cmsis_dsp::Q< M, F, false, uint64_t > |
Unsigned fixed point datatypes on 64 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, false >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, false >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Static Public Member Functions | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = false |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0xFFFFFFFFFFFFFFFFLL |
Maximum representable positive value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
|
inlinestaticconstexpr |
Convert a float to fixed point.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
struct arm_cmsis_dsp::Q< M, F, true, int32_t > |
Signed fixed point datatypes on 32 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, true >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, true >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
constexpr | Q (const Q< M, F, false > &other) |
Convert an unsigned fixed point to this fixed point. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Q & | operator-= (const Q other) |
this -= other | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = true |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0x7FFFFFFFL |
Maximum representable positive value. | |
static constexpr value_type | minVal = 0x80000000L |
Minimum representable negative value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
Convert an unsigned fixed point to this fixed point.
other | The unsigned fixed point number |
Some problem may occur since the unsigned may not be representable with the less bits required for the sign representation. This convertion is not saturating.
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
this -= other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::Q< M, F, false, uint32_t > |
Unsigned fixed point datatypes on 32 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, false >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, false >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = false |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0xFFFFFFFFL |
Maximum representable positive value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::Q< M, F, true, int16_t > |
Signed fixed point datatypes on 16 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, true >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, true >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
constexpr | Q (const Q< M, F, false > &other) |
Convert an unsigned fixed point to this fixed point. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Q & | operator-= (const Q other) |
this -= other | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = true |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0x7FFF |
Maximum representable positive value. | |
static constexpr value_type | minVal = 0x8000 |
Minimum representable negative value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
Convert an unsigned fixed point to this fixed point.
other | The unsigned fixed point number |
Some problem may occur since the unsigned may not be representable with the less bits required for the sign representation. This convertion is not saturating.
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
this -= other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::Q< M, F, false, uint16_t > |
Unsigned fixed point datatypes on 16 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, false >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, false >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = false |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0xFFFF |
Maximum representable positive value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::Q< M, F, true, int8_t > |
Signed fixed point datatypes on 8 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, true >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, true >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
constexpr | Q (const Q< M, F, false > &other) |
Convert an unsigned fixed point to this fixed point. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Q & | operator-= (const Q other) |
this -= other | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = true |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0x7F |
Maximum representable positive value. | |
static constexpr value_type | minVal = 0x80 |
Minimum representable negative value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
Convert an unsigned fixed point to this fixed point.
other | The unsigned fixed point number |
Some problem may occur since the unsigned may not be representable with the less bits required for the sign representation. This convertion is not saturating.
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
this -= other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::Q< M, F, false, uint8_t > |
Unsigned fixed point datatypes on 8 bits.
M | Number of bits for mantissa (without sign bit) |
F | Number of bits for fractional part |
Public Types | |
using | value_type = typename fixed_storage_type< M, F, false >::value_type |
Storage type for the value. | |
using | wider_type = typename fixed_storage_type< M, F, false >::wider_type |
Storage type for the widening of the value. | |
Public Member Functions | |
constexpr | Q () |
Create a new zero fixed point. | |
constexpr | Q (const value_type x) |
Create a new fixed point from a raw integer. | |
bool | operator== (const Q &b) const |
this == b | |
bool | operator!= (const Q &b) const |
this != b | |
bool | operator< (const Q &b) const |
this < b | |
bool | operator> (const Q &b) const |
this > b | |
bool | operator<= (const Q &b) const |
this <= b | |
bool | operator>= (const Q &b) const |
this >= b | |
Q & | operator+= (const Q other) |
this += other | |
Static Public Member Functions | |
static constexpr value_type | sat (const wider_type i) |
Saturate a wider type to the current type. | |
static constexpr value_type | convert (const float f) |
Convert a float to fixed point with saturation. | |
static constexpr Q | f (const float x) |
Create a new fixed point from a float. | |
static constexpr Q | one () |
Fixed point number representing 1. | |
Data Fields | |
value_type | v |
Storage value. | |
Static Public Attributes | |
static constexpr int | fracBits = F |
Number of fractional bits. | |
static constexpr int | mantissaBits = M |
Number of mantissa bits (without sign bit) | |
static constexpr bool | isSigned = false |
Is this number representation signed. | |
static constexpr value_type | maxVal = 0xFF |
Maximum representable positive value. | |
|
inlineexplicitconstexpr |
Create a new fixed point from a raw integer.
x | the raw integer |
|
inlinestaticconstexpr |
Convert a float to fixed point with saturation.
f | float value |
|
inlinestaticconstexpr |
Create a new fixed point from a float.
x | the float |
|
inlinestaticconstexpr |
Fixed point number representing 1.
|
inline |
this != b
b | the other fixed point |
this += other
other | the other fixed point |
|
inline |
this < b
b | the other fixed point |
|
inline |
this <= b
b | the other fixed point |
|
inline |
this == b
b | the other fixed point |
|
inline |
this > b
b | the other fixed point |
|
inline |
this >= b
b | the other fixed point |
|
inlinestaticconstexpr |
Saturate a wider type to the current type.
i | the wider integer type |
struct arm_cmsis_dsp::FixedCastShift< M, FD, FS, S,(FD >FS)> |
Changed fractional representation of a fixed point number using a shift.
M | Number of mantissa bits for the fixed point number |
FD | Number of fractional bits for the destination fixed point number |
FS | Number of fractional bits for the source fixed point number |
S | Is the fixed point number using a signed representation |
src | The fixed point number |
Only applies if FD > FS
struct arm_cmsis_dsp::FixedCastShift< M, FD, FS, S,(FD< FS)> |
Changed fractional representation of a fixed point number using a shift.
M | Number of mantissa bits for the fixed point number |
FD | Number of fractional bits for the destination fixed point number |
FS | Number of fractional bits for the source fixed point number |
S | Is the fixed point number using a signed representation |
src | The fixed point number |
Only applies if FD < FS
struct arm_cmsis_dsp::Accumulate |
Accumulation without saturation.
MD | Number of mantissa bits for the destination fixed point number |
MS | Number of mantissa bits for the source fixed point number |
F | Number of fractional bits for fixed point number |
S | Is the fixed point number using a signed representation |
struct arm_cmsis_dsp::Accumulate< MD, MS, F, S, true > |
Accumulation without saturation.
MD | Number of mantissa bits for the destination fixed point number |
MS | Number of mantissa bits for the source fixed point number |
F | Number of fractional bits for fixed point number |
S | Is the fixed point number using a signed representation |
Static Public Member Functions | |
static Q< MD, F, S > | acc (const Q< MD, F, S > &a, const Q< MS, F, S > &b) |
Accumulation without saturation. | |
Accumulate without saturation.
[in] | a | First fixed point number |
[in] | b | Second fixed point number |
MD | Number of mantissa bits for destination |
MS | Number of mantissa bits fro source |
F | Number of fractional bits |
S | Is the representation signed |
Add two fixed point numbers without saturation.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
b | Second fixed point number |
Multiplication of two fixed point numbers A and B.
MA | Number of mantissa bits for A |
FA | Number of fractional bits for A |
MB | Number of mantissa bits for B |
FB | Number of fractional bits for B |
SA | Is A using a signed representation |
SB | Is B using a signed representation |
a | First fixed point number |
b | Second fixed point number |
Inequality operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
|
constexpr |
q15 literal
x | long double value |
You can write
The float is converted to Q15 at build time.
|
constexpr |
q31 literal
x | long double value |
You can write
The float is converted to Q31 at build time.
|
constexpr |
q63 literal
x | long double value |
You can write
The float is converted to Q63 at build time.
|
constexpr |
q7 literal
x | long double value |
You can write
The float is converted to Q7 at build time.
Multiplication operator.
[in] | a | First value |
[in] | b | Second value |
Multiplication operator.
[in] | a | First value |
[in] | b | Second value |
Multiplication operator.
[in] | a | First value |
[in] | b | Second value |
No op operator.
[in] | a | Fixed point number |
M | Number of mantissa bits |
F | Number of fractional bits |
S | Is the representation signed |
Add two fixed point numbers with saturation.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
b | Second fixed point number |
Negate a fixed point number with saturation.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
Subtract two fixed point numbers with saturation.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
b | Second fixed point number |
Division operator.
[in] | a | First fixed point value |
[in] | b | Integer |
M | Number of mantissa bits |
F | Number of fractional bits |
S | Is representation signed |
Less-than comparison operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
|
inlinenoexcept |
Shift left a fixed point number with a shift known at build time.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
Less-than-or-equal comparison operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
Equality operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
Greater-than comparison operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
Greater-than-or-equal comparison operator.
[in] | a | First value |
[in] | b | Second value |
M | Number of mantissa bits |
F | Number of fractional bits |
Shift right a fixed point number with a shift known at build time.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
|
inline |
Saturate an unsigned fixed point number.
MD | Number of mantissa bits for the destination fixed point number |
MS | Number of mantissa bits for the source fixed point number |
S | Is the fixed point number using a signed representation |
src | The fixed point number |
Only applies if the number is unsigned, the representation requires less than 31 bits (since there is no saturating instruction for 64 bits) and if destination has less mantissa bits.
If destination has more or equal number of mantissa bits then it does not make sense to saturate.
|
inline |
Saturate a signed fixed point number.
MD | Number of mantissa bits for the destination fixed point number |
MS | Number of mantissa bits for the source fixed point number |
S | Is the fixed point number using a signed representation |
src | First fixed point number |
Only applies if the number is signed, the representation requires less than 32 bits (since there is no saturating instruction for 64 bits) and if destination has less mantissa bits.
If destination has more or equal number of mantissa bits then it does not make sense to saturate.
Subtract two fixed point numbers without saturation.
M | Number of mantissa bits for the fixed point number |
F | Number of fractional bits for the fixed point number |
S | Is the fixed point number using a signed representation |
a | First fixed point number |
b | Second fixed point number |
|
constexpr |
Function to identify the template for fixed number representable on 16 bits.
M | number of mantissa bit (without sign bit) |
F | number of fractional bits |
S | sign or unsigned |
|
constexpr |
Function to identify the template for fixed number representable on 32 bits.
M | number of mantissa bit (without sign bit) |
F | number of fractional bits |
S | sign or unsigned |
|
constexpr |
Function to identify the template for fixed number representable on 64 bits.
M | number of mantissa bit (without sign bit) |
F | number of fractional bits |
S | sign or unsigned |
|
constexpr |
Function to identify the template for fixed number representable on 8 bits.
M | number of mantissa bit (without sign bit) |
F | number of fractional bits |
S | sign or unsigned |
Convert between different fractional part formats.
M | Number of mantissa bits for the fixed point number |
FD | Number of fractional bits for the destination fixed point number |
FS | Number of fractional bits for the source fixed point number |
S | Is the fixed point number using a signed representation |
src | The fixed point number |