Mercurial > audlegacy
changeset 1089:e75c7856fbea trunk
[svn] - when using fixed integer based compile -DINTEGER_COMPILE, we want to use long type, not int (also use radixes to emulate FPU math)
author | nenolod |
---|---|
date | Sat, 20 May 2006 20:04:39 -0700 |
parents | 1c54da168b6c |
children | 09eb2c83097a |
files | Plugins/Input/mpg123/mpg123.h |
diffstat | 1 files changed, 27 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/mpg123/mpg123.h Sat May 20 16:24:26 2006 -0700 +++ b/Plugins/Input/mpg123/mpg123.h Sat May 20 20:04:39 2006 -0700 @@ -15,7 +15,17 @@ #ifdef INTEGER_COMPILE -typedef int mpgdec_real; +typedef long mpgdec_real; + +# define REAL_RADIX 15 +# define REAL_FACTOR (32.0 * 1024.0) + +# define REAL_PLUS_32767 ( 32767 << REAL_RADIX ) +# define REAL_MINUS_32768 ( -32768 << REAL_RADIX ) + +# define DOUBLE_TO_REAL(x) ((int)((x) * REAL_FACTOR)) +# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX) +# define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX) #else @@ -23,6 +33,22 @@ #endif +#ifndef DOUBLE_TO_REAL +# define DOUBLE_TO_REAL(x) (x) +#endif +#ifndef REAL_TO_SHORT +# define REAL_TO_SHORT(x) (x) +#endif +#ifndef REAL_PLUS_32767 +# define REAL_PLUS_32767 32767.0 +#endif +#ifndef REAL_MINUS_32768 +# define REAL_MINUS_32768 -32768.0 +#endif +#ifndef REAL_MUL +# define REAL_MUL(x, y) ((x) * (y)) +#endif + enum { SYNTH_AUTO, SYNTH_FPU, @@ -55,16 +81,6 @@ #define MAXFRAMESIZE 4096 -#define DOUBLE_TO_REAL(x) (x) -#define REAL_MUL(x, y) (x * y) - -#ifndef REAL_PLUS_32767 -# define REAL_PLUS_32767 32767.0 -#endif -#ifndef REAL_MINUS_32768 -# define REAL_MINUS_32768 -32768.0 -#endif - struct id3v1tag_t { char tag[3]; /* always "TAG": defines ID3v1 tag 128 bytes before EOF */ char title[30];