File: machine.h

package info (click to toggle)
mp3gain 1.4.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 532 kB
  • ctags: 735
  • sloc: ansic: 7,583; makefile: 75
file content (163 lines) | stat: -rw-r--r-- 3,852 bytes parent folder | download | duplicates (5)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 *	Machine dependent defines/includes for LAME.
 *
 *	Copyright (c) 1999 A.L. Faber
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef LAME_MACHINE_H
#define LAME_MACHINE_H

#include <stdio.h>

#ifdef STDC_HEADERS
# include <stdlib.h>
# include <string.h>
#else
/*# ifndef HAVE_STRCHR
#  define strchr index
#  define strrchr rindex
# endif
char *strchr (), *strrchr ();
*/
# ifndef HAVE_MEMCPY
#  define memcpy(d, s, n) bcopy ((s), (d), (n))
#  define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif

#if  defined(__riscos__)  &&  defined(FPA10)
# include "ymath.h"
#else
# include <math.h>
#endif

#include <ctype.h>

#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif

#if defined(macintosh)
# include <types.h>
# include <stat.h>
#else
# include <sys/types.h>
# include <sys/stat.h>
#endif

/* 
 * 3 different types of pow() functions:
 *   - table lookup
 *   - pow()
 *   - exp()   on some machines this is claimed to be faster than pow()
 */

#define POW20(x)  pow20[x]
//#define POW20(x)  pow(2.0,((double)(x)-210)*.25)
//#define POW20(x)  exp( ((double)(x)-210)*(.25*LOG2) )

#define IPOW20(x)  ipow20[x]
//#define IPOW20(x)  exp( -((double)(x)-210)*.1875*LOG2 )
//#define IPOW20(x)  pow(2.0,-((double)(x)-210)*.1875)


/* in case this is used without configure */
#ifndef inline
# define inline
#endif
/* compatibility */
#define INLINE inline

#if defined(_MSC_VER)
# undef inline
# define inline _inline
#elif defined(__SASC) || defined(__GNUC__)
/* if __GNUC__ we always want to inline, not only if the user requests it */
# undef inline
# define inline __inline
#endif

#if    defined(_MSC_VER)
# pragma warning( disable : 4244 )
//# pragma warning( disable : 4305 )
#endif

/*
 * FLOAT    for variables which require at least 32 bits
 * FLOAT8   for variables which require at least 64 bits
 *
 * On some machines, 64 bit will be faster than 32 bit.  Also, some math
 * routines require 64 bit float, so setting FLOAT=float will result in a
 * lot of conversions.
 */

#if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) )
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#else
# ifndef FLOAT
typedef float   FLOAT;
#  ifdef FLT_MAX
#   define FLOAT_MAX FLT_MAX
#  else
#   define FLOAT_MAX 1e99 /* approx */
#  endif
# endif
#endif

#ifndef FLOAT8  /* NOTE: RH: 7/00:  if FLOAT8=float, it breaks resampling and VBR code */
typedef double  FLOAT8;
# ifdef DBL_MAX
#  define FLOAT8_MAX DBL_MAX
# else
#  define FLOAT8_MAX 1e99 /* approx */
# endif
#else
# ifdef FLT_MAX
#  define FLOAT8_MAX FLT_MAX
# else
#  define FLOAT8_MAX 1e99 /* approx */
# endif
#endif

/* Various integer types */

#if   defined _WIN32 && !defined __CYGWIN__
typedef unsigned char	u_char;
#elif defined __DECALPHA__
// do nothing
#elif defined OS_AMIGAOS
// do nothing
#elif defined __DJGPP__
typedef unsigned char	u_char;
#elif !defined __GNUC__  ||  defined __STRICT_ANSI__
typedef unsigned char	u_char;
#else
// do nothing
#endif

/* sample_t must be floating point, at least 32 bits */
typedef FLOAT     sample_t;
typedef sample_t  stereo_t [2];

#endif

/* end of machine.h */