xine-lib 1.2.11
mathtools.h
Go to the documentation of this file.
1#ifndef MATHTOOLS_H
2#define MATHTOOLS_H
3
4
5#define _double2fixmagic (68719476736.0*1.5)
6/* 2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor */
7#define _shiftamt 16
8/* 16.16 fixed point representation */
9
10#if BigEndian_
11#define iexp_ 0
12#define iman_ 1
13#else
14#define iexp_ 1
15#define iman_ 0
16#endif /* BigEndian_ */
17
18/* TODO: this optimization is very efficient: put it again when all works
19#ifdef HAVE_MMX
20#define F2I(dbl,i) {double d = dbl + _double2fixmagic; i = ((int*)&d)[iman_] >> _shiftamt;}
21#else*/
22#define F2I(dbl,i) i=(int)dbl;
23/*#endif*/
24
25#if 0
26#define SINCOS(f,s,c) \
27 __asm__ __volatile__ ("fsincos" : "=t" (c), "=u" (s) : "0" (f))
28#else
29#define SINCOS(f,s,c) {s=sin(f);c=cos(f);}
30#endif
31
32#include "mathtools.c"
33
34#endif
35