Merge pull request #565 from grejppi/master
move fastPow() to lmms_math.h
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#ifndef _LMMS_MATH_H
|
||||
#define _LMMS_MATH_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
|
||||
@@ -106,5 +107,18 @@ static inline int fast_rand()
|
||||
|
||||
|
||||
|
||||
// source: http://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/
|
||||
static inline double fastPow( double a, double b )
|
||||
{
|
||||
union
|
||||
{
|
||||
double d;
|
||||
int32_t x[2];
|
||||
} u = { a };
|
||||
u.x[1] = static_cast<int32_t>( b * ( u.x[1] - 1072632447 ) + 1072632447 );
|
||||
u.x[0] = 0;
|
||||
return u.d;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "DspEffectLibrary.h"
|
||||
#include "Oscillator.h"
|
||||
|
||||
#include "fastpow.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
template<class FX = DspEffectLibrary::StereoBypass>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
#ifndef FASTPOW_H
|
||||
#define FASTPOW_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* source:
|
||||
* http://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/
|
||||
*/
|
||||
|
||||
double fastPow(double a, double b) {
|
||||
union {
|
||||
double d;
|
||||
int32_t x[2];
|
||||
} u = { a };
|
||||
u.x[1] = (int32_t)(b * (u.x[1] - 1072632447) + 1072632447);
|
||||
u.x[0] = 0;
|
||||
return u.d;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "pixmap_button.h"
|
||||
#include "combobox.h"
|
||||
#include "Oscillator.h"
|
||||
// #include "fastpow.h" // once grejppi's fastpow gets merged
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
#define makeknob( name, x, y, hint, unit, oname ) \
|
||||
@@ -153,19 +153,6 @@ const float MAX_FREQ = 48000.0f;
|
||||
class MonstroInstrument;
|
||||
class MonstroView;
|
||||
|
||||
// use grejppi's once it's merged
|
||||
inline double fastPow( double a, double b )
|
||||
{
|
||||
union
|
||||
{
|
||||
double d;
|
||||
int32_t x[2];
|
||||
} u = { a };
|
||||
u.x[1] = static_cast<int32_t>( b * ( u.x[1] - 1072632447 ) + 1072632447 );
|
||||
u.x[0] = 0;
|
||||
return u.d;
|
||||
}
|
||||
|
||||
|
||||
class MonstroSynth
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user