Commit 1a42ee8e authored by Miller Puckette's avatar Miller Puckette
Browse files

Zmoelnig 64-bit float fixes

parent 067c28c6
......@@ -20,6 +20,15 @@
<H3> <A name="s2"> 5.1. release notes </A> </H3>
<P> ------------------ 0.42 ---------------------------
<P> ".pdrc" loading suppressed if pd is started with "-noprefs".
<P> Bug fix in pipe object: if sending a list to pipe, it didn't update the
delay time when asked to.
<P>
<P> ------------------ 0.41-3,4 ---------------------------
<P> 2 fixes for PC: no bonk~, and the audio device selection
......
......@@ -98,7 +98,7 @@
#define FALSE 0
#endif
#define SAMPLE float /* data type used in calculation */
#define SAMPLE PD_FLOATTYPE /* data type used in calculation */
#define SHORT_SIZE sizeof(short)
#define INT_SIZE sizeof(int)
......@@ -154,8 +154,8 @@ typedef struct Tfft_net {
void cfft(int trnsfrm_dir, int npnt, int window,
float *source_buf, int source_form, int source_scale,
float *result_buf, int result_form, int result_scale, int debug);
SAMPLE *source_buf, int source_form, int source_scale,
SAMPLE *result_buf, int result_form, int result_scale, int debug);
/*****************************************************************************/
......@@ -172,10 +172,10 @@ int power_of_two(int n);
void create_hanning(SAMPLE *window, int n, SAMPLE scale);
void create_rectangular(SAMPLE *window, int n, SAMPLE scale);
void short_to_float(short *short_buf, float *float_buf, int n);
void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
void load_registers(FFT_NET *fft_net, SAMPLE *buf, int buf_form,
int buf_scale, int trnsfrm_dir);
void compute_fft(FFT_NET *fft_net);
void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
void store_registers(FFT_NET *fft_net, SAMPLE *buf, int buf_form,
int buf_scale, int debug);
void build_fft_network(FFT_NET *fft_net, int n, int window_type);
......@@ -184,8 +184,8 @@ void build_fft_network(FFT_NET *fft_net, int n, int window_type);
/*****************************************************************************/
void cfft(int trnsfrm_dir, int npnt, int window,
float *source_buf, int source_form, int source_scale,
float *result_buf, int result_form, int result_scale, int debug)
SAMPLE *source_buf, int source_form, int source_scale,
SAMPLE *result_buf, int result_form, int result_scale, int debug)
/* modifies: result_buf
effects: Computes npnt FFT specified by form, scale, and dir parameters.
......@@ -471,7 +471,7 @@ void build_fft_network(FFT_NET *fft_net, int n, int window_type)
/* REGISTER LOAD AND STORE */
/*****************************************************************************/
void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
void load_registers(FFT_NET *fft_net, SAMPLE *buf, int buf_form,
int buf_scale, int trnsfrm_dir)
/* effects: Multiplies the input buffer with the appropriate window and
......@@ -605,7 +605,7 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form,
}
void store_registers(FFT_NET *fft_net, float *buf, int buf_form,
void store_registers(FFT_NET *fft_net, SAMPLE *buf, int buf_form,
int buf_scale, int debug)
/* modifies: buf
......@@ -989,10 +989,10 @@ void short_to_float(short *short_buf, float *float_buf, int n)
/* here's the meat: */
void pd_fft(float *buf, int npoints, int inverse)
void pd_fft(t_float *buf, int npoints, int inverse)
{
double renorm;
float *fp, *fp2;
SAMPLE *fp, *fp2;
int i;
renorm = (inverse ? npoints : 1.);
cfft((inverse ? INVERSE : FORWARD), npoints, RECTANGULAR,
......
......@@ -97,7 +97,7 @@ static void init_rsqrt(void)
/* these are used in externs like "bonk" */
float q8_rsqrt(float f)
t_float q8_rsqrt(t_float f)
{
long l = *(long *)(&f);
if (f < 0) return (0);
......@@ -105,7 +105,7 @@ float q8_rsqrt(float f)
rsqrt_mantissatab[(l >> 13) & 0x3ff]);
}
float q8_sqrt(float f)
t_float q8_sqrt(t_float f)
{
long l = *(long *)(&f);
if (f < 0) return (0);
......@@ -116,8 +116,8 @@ float q8_sqrt(float f)
/* the old names are OK unless we're in IRIX N32 */
#ifndef N32
float qsqrt(float f) {return (q8_sqrt(f)); }
float qrsqrt(float f) {return (q8_rsqrt(f)); }
t_float qsqrt(t_float f) {return (q8_sqrt(f)); }
t_float qrsqrt(t_float f) {return (q8_rsqrt(f)); }
#endif
......
......@@ -1402,13 +1402,14 @@ static void garray_read(t_garray *x, t_symbol *filename)
}
for (i = 0; i < nelem; i++)
{
if (!fscanf(fd, "%f", ((t_float *)(array->a_vec +
elemsize * i) + yonset)))
float f;
if (!fscanf(fd, "%f", &f))
{
post("%s: read %d elements into table of size %d",
filename->s_name, i, nelem);
break;
}
else *((t_float *)(array->a_vec + elemsize * i) + yonset) = f;
}
while (i < nelem)
*((t_float *)(array->a_vec +
......
......@@ -721,11 +721,11 @@ struct _fielddesc
t_symbol *fd_symbol; /* the field is a constant symbol */
t_symbol *fd_varsym; /* the field is variable and this is the name */
} fd_un;
t_float fd_v1; /* min and max values */
t_float fd_v2;
t_float fd_screen1; /* min and max screen values */
t_float fd_screen2;
t_float fd_quantum; /* quantization in value */
float fd_v1; /* min and max values */
float fd_v2;
float fd_screen1; /* min and max screen values */
float fd_screen2;
float fd_quantum; /* quantization in value */
};
static void fielddesc_setfloat_const(t_fielddesc *fd, t_float f)
......@@ -2225,7 +2225,7 @@ static void drawnumber_key(void *z, t_floatarg fkey)
else
{
/* key entry for a numeric field. This is just a stopgap. */
t_float newf;
float newf;
if (drawnumber_motion_firstkey)
sbuf[0] = 0;
else sprintf(sbuf, "%g", template_getfloat(drawnumber_motion_template,
......
......@@ -55,11 +55,15 @@ extern "C" {
#define MAXPDARG 5 /* max number of args we can typecheck today */
/* signed and unsigned integer types the size of a pointer: */
/* GG: long is the size of a pointer */
typedef long t_int;
typedef float t_float; /* a floating-point number at most the same size */
typedef float t_floatarg; /* floating-point type for function calls */
#if !defined(PD_LONGINTTYPE)
#define PD_LONGINTTYPE long
#endif
#if !defined(PD_FLOATTYPE)
#define PD_FLOATTYPE float
#endif
typedef PD_LONGINTTYPE t_int; /* pointer-size integer */
typedef PD_FLOATTYPE t_float; /* a float type at most the same size */
typedef PD_FLOATTYPE t_floatarg; /* float type for function calls */
typedef struct _symbol
{
......@@ -443,7 +447,7 @@ EXTERN t_propertiesfn class_getpropertiesfn(t_class *c);
EXTERN void post(const char *fmt, ...);
EXTERN void startpost(const char *fmt, ...);
EXTERN void poststring(const char *s);
EXTERN void postfloat(float f);
EXTERN void postfloat(t_floatarg f);
EXTERN void postatom(int argc, t_atom *argv);
EXTERN void endpost(void);
EXTERN void error(const char *fmt, ...);
......@@ -474,7 +478,7 @@ EXTERN int sys_trylock(void);
/* --------------- signals ----------------------------------- */
typedef float t_sample;
typedef PD_FLOATTYPE t_sample;
#define MAXLOGSIG 32
#define MAXSIGSIZE (1 << MAXLOGSIG)
......
......@@ -282,7 +282,8 @@ int sys_main(int argc, char **argv)
if (!noprefs)
sys_loadpreferences(); /* load default settings */
#ifndef MSW
sys_rcfile(); /* parse the startup file */
if (!noprefs)
sys_rcfile(); /* parse the startup file */
#endif
if (sys_argparse(argc-1, argv+1)) /* parse cmd line */
return (1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment