Classes |
Public Types |
Public Member Functions |
Static Public Member Functions |
Static Public Attributes |
List of all members
playrho::Fixed< BASE_TYPE, FRACTION_BITS > Class Template Reference
Template class for fixed-point numbers. More...
#include <Fixed.hpp>
Public Types | |
enum | CmpResult { CmpResult::Incomparable, CmpResult::Equal, CmpResult::LessThan, CmpResult::GreaterThan } |
Compare result enumeration. More... | |
using | value_type = BASE_TYPE |
Value type. More... | |
Public Member Functions | |
Fixed ()=default | |
PLAYRHO_CONSTEXPR | Fixed (long double val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (double val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (float val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (unsigned long long val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (unsigned long val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (unsigned int val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (long long val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (long val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (int val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (short val) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | Fixed (value_type val, unsigned int fraction) noexcept |
Initializing constructor. More... | |
template<typename BT , unsigned int FB> | |
PLAYRHO_CONSTEXPR | Fixed (const Fixed< BT, FB > val) noexcept |
Initializing constructor. More... | |
template<typename T > | |
PLAYRHO_CONSTEXPR T | ConvertTo () const noexcept |
Converts the value to the expressed type. More... | |
PLAYRHO_CONSTEXPR CmpResult | Compare (const Fixed other) const noexcept |
Compares this value to the given one. More... | |
PLAYRHO_CONSTEXPR | operator long double () const noexcept |
Long double operator. More... | |
PLAYRHO_CONSTEXPR | operator double () const noexcept |
Double operator. More... | |
PLAYRHO_CONSTEXPR | operator float () const noexcept |
Float operator. More... | |
PLAYRHO_CONSTEXPR | operator long long () const noexcept |
Long long operator. More... | |
PLAYRHO_CONSTEXPR | operator long () const noexcept |
Long operator. More... | |
PLAYRHO_CONSTEXPR | operator unsigned long long () const noexcept |
Unsigned long long operator. More... | |
PLAYRHO_CONSTEXPR | operator unsigned long () const noexcept |
Unsigned long operator. More... | |
PLAYRHO_CONSTEXPR | operator unsigned int () const noexcept |
Unsigned int operator. More... | |
PLAYRHO_CONSTEXPR | operator int () const noexcept |
int operator. More... | |
PLAYRHO_CONSTEXPR | operator short () const noexcept |
short operator. More... | |
PLAYRHO_CONSTEXPR Fixed | operator- () const noexcept |
Negation operator. More... | |
PLAYRHO_CONSTEXPR Fixed | operator+ () const noexcept |
Positive operator. More... | |
PLAYRHO_CONSTEXPR | operator bool () const noexcept |
Boolean operator. More... | |
PLAYRHO_CONSTEXPR bool | operator! () const noexcept |
Logical not operator. More... | |
PLAYRHO_CONSTEXPR Fixed & | operator+= (Fixed val) noexcept |
Addition assignment operator. More... | |
PLAYRHO_CONSTEXPR Fixed & | operator-= (Fixed val) noexcept |
Subtraction assignment operator. More... | |
PLAYRHO_CONSTEXPR Fixed & | operator*= (Fixed val) noexcept |
Multiplication assignment operator. More... | |
PLAYRHO_CONSTEXPR Fixed & | operator/= (Fixed val) noexcept |
Division assignment operator. More... | |
PLAYRHO_CONSTEXPR Fixed & | operator%= (Fixed val) noexcept |
Modulo operator. More... | |
PLAYRHO_CONSTEXPR bool | isfinite () const noexcept |
Is finite. More... | |
PLAYRHO_CONSTEXPR bool | isnan () const noexcept |
Is NaN. More... | |
PLAYRHO_CONSTEXPR int | getsign () const noexcept |
Gets this value's sign. More... | |
Static Public Member Functions | |
static PLAYRHO_CONSTEXPR Fixed | GetMin () noexcept |
Gets the min value this type is capable of expressing. More... | |
static PLAYRHO_CONSTEXPR Fixed | GetInfinity () noexcept |
Gets an infinite value for this type. More... | |
static PLAYRHO_CONSTEXPR Fixed | GetMax () noexcept |
Gets the max value this type is capable of expressing. More... | |
static PLAYRHO_CONSTEXPR Fixed | GetNaN () noexcept |
Gets a NaN value for this type. More... | |
static PLAYRHO_CONSTEXPR Fixed | GetNegativeInfinity () noexcept |
Gets the negative infinity value for this type. More... | |
static PLAYRHO_CONSTEXPR Fixed | GetLowest () noexcept |
Gets the lowest value this type is capable of expressing. More... | |
template<typename T > | |
static PLAYRHO_CONSTEXPR value_type | GetFromFloat (T val) noexcept |
Gets the value from a floating point value. More... | |
template<typename T > | |
static PLAYRHO_CONSTEXPR value_type | GetFromSignedInt (T val) noexcept |
Gets the value from a signed integral value. More... | |
template<typename T > | |
static PLAYRHO_CONSTEXPR value_type | GetFromUnsignedInt (T val) noexcept |
Gets the value from an unsigned integral value. More... | |
Static Public Attributes | |
static const PLAYRHO_CONSTEXPR unsigned int | TotalBits = sizeof(BASE_TYPE) * 8 |
Total number of bits. More... | |
static const PLAYRHO_CONSTEXPR unsigned int | FractionBits = FRACTION_BITS |
Fraction bits. More... | |
static const PLAYRHO_CONSTEXPR unsigned int | WholeBits = TotalBits - FractionBits |
Whole value bits. More... | |
static const PLAYRHO_CONSTEXPR value_type | ScaleFactor = static_cast<value_type>(1u << FractionBits) |
Scale factor. More... | |
Detailed Description
template<typename BASE_TYPE, unsigned int FRACTION_BITS>
class playrho::Fixed< BASE_TYPE, FRACTION_BITS >
Template class for fixed-point numbers.
This is a fixed point type template for a given base type using a given number of fraction bits that satisfies the LiteralType
concept.
Member Typedef Documentation
◆ value_type
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
using playrho::Fixed< BASE_TYPE, FRACTION_BITS >::value_type = BASE_TYPE |
Member Enumeration Documentation
◆ CmpResult
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
strong |
Constructor & Destructor Documentation
◆ Fixed() [1/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
default |
◆ Fixed() [2/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [3/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [4/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [5/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [6/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [7/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [8/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [9/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [10/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [11/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [12/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ Fixed() [13/13]
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
template<typename BT , unsigned int FB>
|
inlinenoexcept |
Member Function Documentation
◆ GetMin()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetInfinity()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetMax()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetNaN()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetNegativeInfinity()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetLowest()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinestaticnoexcept |
◆ GetFromFloat()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
template<typename T >
|
inlinestaticnoexcept |
◆ GetFromSignedInt()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
template<typename T >
|
inlinestaticnoexcept |
◆ GetFromUnsignedInt()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
template<typename T >
|
inlinestaticnoexcept |
◆ ConvertTo()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
template<typename T >
|
inlinenoexcept |
◆ Compare()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator long double()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator double()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator float()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator long long()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator long()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator unsigned long long()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator unsigned long()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator unsigned int()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator int()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator short()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator-()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator+()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator bool()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlineexplicitnoexcept |
◆ operator!()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator+=()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator-=()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator*=()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator/=()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ operator%=()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ isfinite()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ isnan()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
◆ getsign()
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
inlinenoexcept |
Member Data Documentation
◆ TotalBits
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
static |
◆ FractionBits
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
static |
◆ WholeBits
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
static |
◆ ScaleFactor
template<typename BASE_TYPE , unsigned int FRACTION_BITS>
|
static |
The documentation for this class was generated from the following file:
- Common/Fixed.hpp