2 * Machine dependent defines/includes for LAME.
4 * Copyright (c) 1999 A.L. Faber
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.
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.
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.
22 #ifndef LAME_MACHINE_H
23 #define LAME_MACHINE_H
27 #if (LAME_RELEASE_VERSION == 0)
40 # define strrchr rindex
42 char *strchr(), *strrchr();
44 # define memcpy(d, s, n) bcopy ((s), (d), (n))
45 # define memmove(d, s, n) bcopy ((s), (d), (n))
49 #if defined(__riscos__) && defined(FPA10)
65 #if defined(macintosh)
69 # include <sys/types.h>
70 # include <sys/stat.h>
73 #ifdef HAVE_INTTYPES_H
74 # include <inttypes.h>
86 * 3 different types of pow() functions:
89 * - exp() on some machines this is claimed to be faster than pow()
92 #define POW20(x) (assert(0 <= (x+Q_MAX2) && x < Q_MAX), pow20[x+Q_MAX2])
93 /*#define POW20(x) pow(2.0,((double)(x)-210)*.25) */
94 /*#define POW20(x) exp( ((double)(x)-210)*(.25*LOG2) ) */
96 #define IPOW20(x) (assert(0 <= x && x < Q_MAX), ipow20[x])
97 /*#define IPOW20(x) exp( -((double)(x)-210)*.1875*LOG2 ) */
98 /*#define IPOW20(x) pow(2.0,-((double)(x)-210)*.1875) */
100 /* in case this is used without configure */
105 #if defined(_MSC_VER)
107 # define inline _inline
108 #elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC)
109 /* if __GNUC__ we always want to inline, not only if the user requests it */
111 # define inline __inline
114 #if defined(_MSC_VER)
115 # pragma warning( disable : 4244 )
116 /*# pragma warning( disable : 4305 ) */
120 * FLOAT for variables which require at least 32 bits
121 * FLOAT8 for variables which require at least 64 bits
123 * On some machines, 64 bit will be faster than 32 bit. Also, some math
124 * routines require 64 bit float, so setting FLOAT=float will result in a
125 * lot of conversions.
128 #if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) )
129 # define WIN32_LEAN_AND_MEAN
130 # include <windows.h>
132 # define FLOAT_MAX FLT_MAX
137 # define FLOAT_MAX FLT_MAX
139 # define FLOAT_MAX 1e37 /* approx */
145 typedef double FLOAT8;
147 # define FLOAT8_MAX DBL_MAX
149 # define FLOAT8_MAX 1e99 /* approx */
153 # define FLOAT8_MAX FLT_MAX
155 # define FLOAT8_MAX 1e37 /* approx */
159 /* sample_t must be floating point, at least 32 bits */
160 typedef FLOAT sample_t;
162 #define dimension_of(array) (sizeof(array)/sizeof(array[0]))
163 #define beyond(array) (array+dimension_of(array))
167 (fabs(a) > fabs(b)) \
168 ? (fabs((a)-(b)) <= (fabs(a) * 1e-6f)) \
169 : (fabs((a)-(b)) <= (fabs(b) * 1e-6f)))
171 #define EQ(a,b) (fabs((a)-(b))<1E-37)
174 #define NEQ(a,b) (!EQ(a,b))
182 # define log10f log10
189 # define log10f log10
192 /* end of machine.h */