|
LMMS
|
#include <fixed_point.h>
Public Member Functions | |
| fixed_point () | |
| default constructor, does not initialize the value, just like - say - float doesn't | |
| template<class U, int FracBits2> | |
| fixed_point (const fixed_point< U, FracBits2 > &v) | |
| copy constructor from any other fixed_point value | |
| fixed_point (double v) | |
| void | set (T value) |
| T | get () const |
| operator double () const | |
| fixed_point & | operator= (double v) |
| template<class U, int FracBits2> | |
| fixed_point & | operator= (const fixed_point< U, FracBits2 > &v) |
| template<class U, int FracBits2> | |
| fixed_point & | operator+= (const fixed_point< U, FracBits2 > &v) |
| template<class U, int FracBits2> | |
| fixed_point & | operator-= (const fixed_point< U, FracBits2 > &v) |
| template<class U, int FracBits2> | |
| fixed_point | operator+ (const fixed_point< U, FracBits2 > &v) const |
| template<class U, int FracBits2> | |
| fixed_point | operator- (const fixed_point< U, FracBits2 > &v) const |
| template<class U, int FracBits2> | |
| fixed_point | operator* (const fixed_point< U, FracBits2 > &v) const |
| multiply two fixed point values, using long long int to store the temporary multiplication result | |
| template<class U, int FracBits2, class BigType> | |
| fixed_point & | operator*= (const fixed_point< U, FracBits2 > &v) |
| multiply two fixed point values, using BigType (usually 64-bit int) to store the temporary multiplication result | |
| fixed_point | operator+ (int v) const |
| fixed_point | operator- (int v) const |
| fixed_point | operator* (int v) const |
| fixed_point & | operator+= (int v) |
| fixed_point & | operator-= (int v) |
| fixed_point & | operator*= (int v) |
| T | ipart () const |
| return integer part | |
| unsigned int | uipart () const |
| return integer part as unsigned int | |
| unsigned int | ui64part () const |
| return integer part as unsigned int | |
| T | fpart () const |
| return fractional part as 0..(2^FracBits-1) | |
| template<int Bits> | |
| T | fpart () const |
| return fractional part as 0..(2^Bits-1) | |
| double | fpart_as_double () const |
| return fractional part as 0..1 | |
| template<class U, int UseBits, class MulType> | |
| U | lerp_by_fract_int (U v1, U v2) const |
| template<class U, int UseBits> | |
| U | lerp_table_lookup_int (U *data) const |
| template<class U, int UseBits> | |
| U | lerp_table_lookup_int_shift (U *data, unsigned int shift) |
| template<class U> | |
| U | lerp_table_lookup_float (U *data) const |
| template<class U> | |
| U | lerp_table_lookup_float_mask (U *data, unsigned int mask) const |
| template<class U, int UseBits, class MulType> | |
| U | lerp_ptr_lookup_int (U *data) const |
| template<class U> | |
| U | lerp_ptr_lookup_float (U *data) const |
Static Public Member Functions | |
| static fixed_point | from_base (const T &v) |
| Makes an instance from a representation value (ie. same type of value as is used for internal storage and get/set). | |
| static T | one () |
| template<class U, int FracBits2> | |
| static T | rebase (const fixed_point< U, FracBits2 > &v) |
Private Types | |
| enum | { IntBits = (sizeof(T)*8) - FracBits } |
Private Attributes | |
| T | value |
|
private |
|
inline |
default constructor, does not initialize the value, just like - say - float doesn't
|
inline |
copy constructor from any other fixed_point value
|
inlineexplicit |
|
inline |
return fractional part as 0..(2^Bits-1)
|
inline |
return fractional part as 0..(2^FracBits-1)
|
inline |
return fractional part as 0..1
|
inlinestatic |
Makes an instance from a representation value (ie. same type of value as is used for internal storage and get/set).
|
inline |
|
inline |
return integer part
|
inline |
use fractional part (either whole or given number of most significant bits) for interpolating between two values note that it uses integer arithmetic only, and isn't suitable for floating point or fixed point U!
| UseBits | can be used when there's a risk of exceeding range of U because max(fpart)*max(v1 or v2) > range of U |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Untested... I've started it to get a sin/cos readout for rotaryorgan, but decided to use table-less solution instead Do not assume it works, because it most probably doesn't
|
inlinestatic |
|
inline |
|
inline |
multiply two fixed point values, using long long int to store the temporary multiplication result
|
inline |
|
inline |
multiply two fixed point values, using BigType (usually 64-bit int) to store the temporary multiplication result
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
return integer part as unsigned int
|
inline |
return integer part as unsigned int
|
private |