PAlib
Public Member Functions | Static Public Member Functions
PA::Fixed Class Reference

Fixed-point wrapper class. More...

#include <PA_FixedPointClass.h>

Public Member Functions

 Fixed ()
 Empty constructor.
 
 Fixed (const Fixed &a)
 Copy constructor.
 
 Fixed (int a)
 int constructor.
 
 Fixed (float a)
 float constructor.
 
 operator int () const
 int cast.
 
 operator float () const
 float cast.
 
 operator bool () const
 bool cast.
 
 operator char () const
 char cast.
 
 operator short () const
 short cast.
 
 operator long long () const
 long long cast.
 
Fixedoperator= (const Fixed &a)
 Assignment operator.
 
Fixed operator+ (const Fixed &a) const
 Addition operator. int and float versions also available.
 
Fixed operator- (const Fixed &a) const
 Subtraction operator. int and float versions also available.
 
Fixed operator* (const Fixed &a) const
 Multiplication operator. int and float versions also available.
 
Fixed operator/ (const Fixed &a) const
 Division operator. int and float versions also available.
 
Fixed operator% (const Fixed &a) const
 Modulo operator. int and float versions also available.
 
Fixed operator++ ()
 Pre-increment operator.
 
Fixed operator-- ()
 Pre-decrement operator.
 
Fixed operator++ (int)
 Post-increment operator.
 
Fixed operator-- (int)
 Post-decrement operator.
 
Fixed operator- () const
 Negation operator.
 
Fixed operator~ () const
 Binary negation operator.
 
Fixedoperator+= (const Fixed &a)
 Addition and assignment operator. int and float versions also available.
 
Fixedoperator-= (const Fixed &a)
 Subtraction and assignment operator. int and float versions also available.
 
Fixedoperator*= (const Fixed &a)
 Multiplication and assignment operator. int and float versions also available.
 
Fixedoperator%= (const Fixed &a)
 Modulo and assignment operator. int and float versions also available.
 
bool operator== (const Fixed &a) const
 Equals operator. int and float versions also available.
 
bool operator!= (const Fixed &a) const
 Not-equals operator. int and float versions also available.
 
bool operator<= (const Fixed &a) const
 Less-or-equal operator. int and float versions also available.
 
bool operator>= (const Fixed &a) const
 Greater-or-equal operator. int and float versions also available.
 
bool operator< (const Fixed &a) const
 Less-than operator. int and float versions also available.
 
bool operator> (const Fixed &a) const
 Greater-than operator. int and float versions also available.
 
Fixed operator<< (int a) const
 Left shift operator.
 
Fixed operator>> (int a) const
 Right shift operator.
 
Fixedoperator<<= (int a)
 Left shift and assign operator.
 
Fixedoperator>>= (int a)
 Right shift and assign operator.
 
Fixed operator& (u32 a) const
 Binary AND operator, u32 version.
 
Fixed operator| (u32 a) const
 Binary OR operator, u32 version.
 
Fixed operator^ (u32 a) const
 Binary XOR operator, u32 version.
 
Fixed operator& (const Fixed &a) const
 Binary AND operator, Fixed version.
 
Fixed operator| (const Fixed &a) const
 Binary OR operator, Fixed version.
 
Fixed operator^ (const Fixed &a) const
 Binary XOR operator, Fixed version.
 
Fixedoperator&= (u32 a)
 Binary AND assignment, u32 version.
 
Fixedoperator|= (u32 a)
 Binary OR assignment, u32 version.
 
Fixedoperator^= (u32 a)
 Binary XOR assignment, u32 version.
 
Fixedoperator&= (const Fixed &a)
 Binary AND assignment, Fixed version.
 
Fixedoperator|= (const Fixed &a)
 Binary OR assignment, Fixed version.
 
Fixedoperator^= (const Fixed &a)
 Binary XOR assignment, Fixed version.
 
Fixed sqrt () const
 Gets the square root.
 
Fixed abs () const
 Gets the absolute value.
 
int raw () const
 Gets the raw Q12 fixed point number.
 

Static Public Member Functions

static Fixed r2f (int a)
 Creates a Fixed object using a raw Q12 fixed point number.
 

Detailed Description

Fixed-point wrapper class.