rockbox/apps/plugins/fft/math.h
Michael Sevakis 95e23defb0 Make fixepoint.c as a shared library (libfixedpoint.a).
Change-Id: Icc10d6e85f890c432f191233a4d64e09f00be43d
Reviewed-on: http://gerrit.rockbox.org/456
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-04-26 00:11:04 +02:00

20 lines
527 B
C

#ifndef __MATH_H_
#define __MATH_H_
#include <inttypes.h>
#include <math.h>
#include "fixedpoint.h"
#define Q_MUL(a, b, bits) (( (int64_t) (a) * (int64_t) (b) ) >> (bits))
#define Q15_MUL(a, b) Q_MUL(a,b,15)
#define Q16_MUL(a, b) Q_MUL(a,b,16)
#define Q_DIV(a, b, bits) ( (((int64_t) (a)) << (bits)) / (b) )
#define Q15_DIV(a, b) Q_DIV(a,b,15)
#define Q16_DIV(a, b) Q_DIV(a,b,16)
#define float_q(a, bits) (int32_t)( ((float)(a)) *(1<<(bits)))
#define float_q15(a) float_q(a, 15)
#define float_q16(a) float_q(a, 16)
#endif