32-bit fixed-point maths routines More...
#include "common.h"#include "fix.h"
Go to the source code of this file.
Defines | |
| #define | FIX_USE_64BIT_MUL |
| #define | FIX_UNROLL_DIV_LOOP |
Functions | |
| static int | Interpolate (const int *table, int value, int shift) |
32-bit fixed-point maths routines
Definition in file fix.cpp.
| #define FIX_USE_64BIT_MUL |
| #define FIX_UNROLL_DIV_LOOP |
| static int Interpolate | ( | const int * | table, | |
| int | value, | |||
| int | shift | |||
| ) | [static] |
Helper function for interpolatating lookup tables used by transcendental functions.
If the lookup table represents the function f(x) over the range 0 to N<<shift, then it must contain entries for: { f(-1<<shift), f(0), f(1<<shift), f(2<<shift), ... f((N-1)<<shift)), f(N<<shift), f((N+1)<<shift)) }. This function then returns f(value).
Notes:
int shifted right by shift. (The exact conditions which cause overflow are more complex than this, therefore it is advised that any table is tested for correctness using all posible values of value.)| table | The lookup table. | |
| value | The value to lookup in table. | |
| shift | The number of least significant bits in value which are discarded when indexing into table. |
1.6.1