summaryrefslogtreecommitdiff
path: root/src/post/goom/mathtools.h
blob: 7ed0f80ef6fbdb665314dc75cb106331ca56724c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define _double2fixmagic (68719476736.0*1.5)
//2^36 * 1.5,  (52-_shiftamt=36) uses limited precisicion to floor
#define _shiftamt 16
//16.16 fixed point representation,

#if BigEndian_
#define iexp_				0
#define iman_				1
#else
#define iexp_				1
#define iman_				0
#endif //BigEndian_

#ifdef HAVE_MMX
#define F2I(dbl,i) \
{double d = dbl + _double2fixmagic; i = ((int*)&d)[iman_] >> _shiftamt; }
#else
#define F2I(dbl,i) i=(int)dbl;
#endif

#if 0
#define SINCOS(f,s,c) \
  __asm__ __volatile__ ("fsincos" : "=t" (c), "=u" (s) : "0" (f))
#else
#define SINCOS(f,s,c) {s=sin(f);c=cos(f);}
#endif