polygon intersector: added horizontal line reconstruction
[swftools.git] / lib / lame / machine.h
1 /*
2  *      Machine dependent defines/includes for LAME.
3  *
4  *      Copyright (c) 1999 A.L. Faber
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef LAME_MACHINE_H
23 #define LAME_MACHINE_H
24
25 #include <stdio.h>
26
27 #ifdef STDC_HEADERS
28 # include <stdlib.h>
29 # include <string.h>
30 #else
31 # ifndef HAVE_STRCHR
32 #  define strchr index
33 #  define strrchr rindex
34 # endif
35 char *strchr (), *strrchr ();
36 # ifndef HAVE_MEMCPY
37 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
38 #  define memmove(d, s, n) bcopy ((s), (d), (n))
39 # endif
40 #endif
41
42 #if  defined(__riscos__)  &&  defined(FPA10)
43 # include "ymath.h"
44 #else
45 # include <math.h>
46 #endif
47
48 #include <ctype.h>
49
50 #ifdef HAVE_ERRNO_H
51 # include <errno.h>
52 #endif
53 #ifdef HAVE_FCNTL_H
54 # include <fcntl.h>
55 #endif
56
57 #if defined(macintosh)
58 # include <types.h>
59 # include <stat.h>
60 #else
61 # include <sys/types.h>
62 # include <sys/stat.h>
63 #endif
64
65 /* 
66  * 3 different types of pow() functions:
67  *   - table lookup
68  *   - pow()
69  *   - exp()   on some machines this is claimed to be faster than pow()
70  */
71
72 #define POW20(x)  pow20[x]
73 //#define POW20(x)  pow(2.0,((double)(x)-210)*.25)
74 //#define POW20(x)  exp( ((double)(x)-210)*(.25*LOG2) )
75
76 #define IPOW20(x)  ipow20[x]
77 //#define IPOW20(x)  exp( -((double)(x)-210)*.1875*LOG2 )
78 //#define IPOW20(x)  pow(2.0,-((double)(x)-210)*.1875)
79
80 #define IIPOW20_(x) iipow20_[x]
81
82 /* in case this is used without configure */
83 #ifndef inline
84 # define inline
85 #endif
86 /* compatibility */
87 #define INLINE inline
88
89 #if defined(_MSC_VER)
90 # undef inline
91 # define inline _inline
92 #elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC)
93 /* if __GNUC__ we always want to inline, not only if the user requests it */
94 # undef inline
95 # define inline __inline
96 #endif
97
98 #if    defined(_MSC_VER)
99 # pragma warning( disable : 4244 )
100 //# pragma warning( disable : 4305 )
101 #endif
102
103 /*
104  * FLOAT    for variables which require at least 32 bits
105  * FLOAT8   for variables which require at least 64 bits
106  *
107  * On some machines, 64 bit will be faster than 32 bit.  Also, some math
108  * routines require 64 bit float, so setting FLOAT=float will result in a
109  * lot of conversions.
110  */
111
112 #if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) )
113 # define WIN32_LEAN_AND_MEAN
114 # include <windows.h>
115 #else
116 # ifndef FLOAT
117 typedef float   FLOAT;
118 #  ifdef FLT_MAX
119 #   define FLOAT_MAX FLT_MAX
120 #  else
121 #   define FLOAT_MAX 1e99 /* approx */
122 #  endif
123 # endif
124 #endif
125
126 #ifndef FLOAT8  /* NOTE: RH: 7/00:  if FLOAT8=float, it breaks resampling and VBR code */
127 typedef double  FLOAT8;
128 # ifdef DBL_MAX
129 #  define FLOAT8_MAX DBL_MAX
130 # else
131 #  define FLOAT8_MAX 1e99 /* approx */
132 # endif
133 #else
134 # ifdef FLT_MAX
135 #  define FLOAT8_MAX FLT_MAX
136 # else
137 #  define FLOAT8_MAX 1e99 /* approx */
138 # endif
139 #endif
140
141 /* Various integer types */
142
143 #if   defined _WIN32 && !defined __CYGWIN__
144 typedef unsigned char   u_char;
145 #elif defined __DECALPHA__
146 // do nothing
147 #elif defined OS_AMIGAOS
148 // do nothing
149 #elif defined __DJGPP__
150 typedef unsigned char   u_char;
151 #elif !defined __GNUC__  ||  defined __STRICT_ANSI__
152 typedef unsigned char   u_char;
153 #else
154 // do nothing
155 #endif
156
157 /* sample_t must be floating point, at least 32 bits */
158 typedef FLOAT     sample_t;
159 typedef sample_t  stereo_t [2];
160
161 #endif
162
163 /* end of machine.h */