From 8a1f9a4f0ab95572bf1eb8f8b7b6de0ba23d077a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 29 Sep 2006 13:58:29 +0000 Subject: [PATCH] move libc aliases from mathutils.h to to aubio_priv.h move libc aliases from mathutils.h to to aubio_priv.h --- src/aubio_priv.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mathutils.h | 51 ----------------------------------------------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/aubio_priv.h b/src/aubio_priv.h index 07d61048..36a0bf41 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -117,4 +117,56 @@ typedef enum { #define AUBIO_QUIT(_s) exit(_s) #define AUBIO_SPRINTF sprintf +/* Libc shortcuts */ +#define PI (M_PI) +#define TWO_PI (PI*2.) + +/* aliases to math.h functions */ +#define EXP expf +#define COS cosf +#define SIN sinf +#define ABS fabsf +#define POW powf +#define SQRT sqrtf +#define LOG10 log10f +#define LOG logf +#define FLOOR floorf +#define TRUNC truncf + +/* aliases to complex.h functions */ +#if !defined(HAVE_COMPLEX_H) || defined(WIN32) +/* mingw32 does not know about c*f functions */ +#define EXPC cexp +/** complex = CEXPC(complex) */ +#define CEXPC cexp +/** sample = ARGC(complex) */ +#define ARGC carg +/** sample = ABSC(complex) norm */ +#define ABSC cabs +/** sample = REAL(complex) */ +#define REAL creal +/** sample = IMAG(complex) */ +#define IMAG cimag +#else +/** sample = EXPC(complex) */ +#define EXPC cexpf +/** complex = CEXPC(complex) */ +#define CEXPC cexp +/** sample = ARGC(complex) */ +#define ARGC cargf +/** sample = ABSC(complex) norm */ +#define ABSC cabsf +/** sample = REAL(complex) */ +#define REAL crealf +/** sample = IMAG(complex) */ +#define IMAG cimagf +#endif + +/* handy shortcuts */ +#define DB2LIN(g) (POW(10.0f,(g)*0.05f)) +#define LIN2DB(v) (20.0f*LOG10(v)) +#define SQR(_a) (_a*_a) + +#define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; } + #endif/*_AUBIO_PRIV_H*/ diff --git a/src/mathutils.h b/src/mathutils.h index ef2def44..bd5ba1a9 100644 --- a/src/mathutils.h +++ b/src/mathutils.h @@ -29,57 +29,6 @@ #ifndef MATHUTILS_H #define MATHUTILS_H -#define PI (M_PI) -#define TWO_PI (PI*2.) - -/* aliases to math.h functions */ -#define EXP expf -#define COS cosf -#define SIN sinf -#define ABS fabsf -#define POW powf -#define SQRT sqrtf -#define LOG10 log10f -#define LOG logf -#define FLOOR floorf -#define TRUNC truncf - -/* aliases to complex.h functions */ -#if defined(WIN32) -/* mingw32 does not know about c*f functions */ -#define EXPC cexp -/** complex = CEXPC(complex) */ -#define CEXPC cexp -/** sample = ARGC(complex) */ -#define ARGC carg -/** sample = ABSC(complex) norm */ -#define ABSC cabs -/** sample = REAL(complex) */ -#define REAL creal -/** sample = IMAG(complex) */ -#define IMAG cimag -#else -/** sample = EXPC(complex) */ -#define EXPC cexpf -/** complex = CEXPC(complex) */ -#define CEXPC cexp -/** sample = ARGC(complex) */ -#define ARGC cargf -/** sample = ABSC(complex) norm */ -#define ABSC cabsf -/** sample = REAL(complex) */ -#define REAL crealf -/** sample = IMAG(complex) */ -#define IMAG cimagf -#endif - -/* handy shortcuts */ -#define DB2LIN(g) (POW(10.0f,(g)*0.05f)) -#define LIN2DB(v) (20.0f*LOG10(v)) -#define SQR(_a) (_a*_a) - -#define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; } - /** Window types * * inspired from -- 2.26.2