From 78d3861035fad392bcf7b7a424931beaf589bc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 13 Jan 2009 16:50:33 +0000 Subject: make array access 64bit-able svn path=/trunk/externals/iem/iem_spec2/; revision=10530 --- src/iemlib.h | 12 ++++++++++++ src/spec2_tab_conv~.c | 4 ++-- src/spec2_tabreceive_enable~.c | 4 ++-- src/spec2_tabreceive~.c | 8 ++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/iemlib.h b/src/iemlib.h index 973bfeb..4c229e3 100644 --- a/src/iemlib.h +++ b/src/iemlib.h @@ -99,4 +99,16 @@ union tabfudge_f #endif +/* on 64bit systems we cannot use garray_getfloatarray... */ +#if (defined __x86_64__) +# define iemarray_t t_word +# define iemarray_getarray garray_getfloatwords +# define iemarray_getfloat(pointer, index) (pointer[index].w_float) +#else +# define iemarray_t t_float +# define iemarray_getarray garray_getfloatarray +# define iemarray_getfloat(pointer, index) (pointer[index]) +#endif + + #endif diff --git a/src/spec2_tab_conv~.c b/src/spec2_tab_conv~.c index e165a71..42d279c 100644 --- a/src/spec2_tab_conv~.c +++ b/src/spec2_tab_conv~.c @@ -12,7 +12,7 @@ typedef struct spec2_tab_conv_tilde { t_object x_obj; t_float *x_spec; - t_float *x_beg_array; + iemarray_t *x_beg_array; int x_blocksize; int x_winsize; int x_has_changed; @@ -82,7 +82,7 @@ static void spec2_tab_conv_tilde_dsp(t_spec2_tab_conv_tilde *x, t_signal **sp) if(*x->x_sym_array->s_name) error("spec2_tab_conv~: %s: no such array", x->x_sym_array->s_name); } - else if(!garray_getfloatarray(a, &n_points, &x->x_beg_array)) + else if(!iemarray_getarray(a, &n_points, &x->x_beg_array)) error("%s: bad template for spec2_tab_conv~", x->x_sym_array->s_name); else { diff --git a/src/spec2_tabreceive_enable~.c b/src/spec2_tabreceive_enable~.c index c2d7475..54efc38 100644 --- a/src/spec2_tabreceive_enable~.c +++ b/src/spec2_tabreceive_enable~.c @@ -13,7 +13,7 @@ static t_class *spec2_tabreceive_enable_tilde_class; typedef struct _spec2_tabreceive_enable_tilde { t_object x_obj; - t_float *x_vec; + iemarray_t *x_vec; t_symbol *x_arrayname; int x_enable; } t_spec2_tabreceive_enable_tilde; @@ -123,7 +123,7 @@ static void spec2_tabreceive_enable_tilde_dsp(t_spec2_tabreceive_enable_tilde *x if(*x->x_arrayname->s_name) error("spec2_tabreceive_enable~: %s: no such array", x->x_arrayname->s_name); } - else if(!garray_getfloatarray(a, &vecsize, &x->x_vec)) + else if(!iemarray_getarray(a, &vecsize, &x->x_vec)) error("%s: bad template for spec2_tabreceive_enable~", x->x_arrayname->s_name); else { diff --git a/src/spec2_tabreceive~.c b/src/spec2_tabreceive~.c index 30ed32e..f0b3577 100644 --- a/src/spec2_tabreceive~.c +++ b/src/spec2_tabreceive~.c @@ -13,7 +13,7 @@ static t_class *spec2_tabreceive_tilde_class; typedef struct _spec2_tabreceive_tilde { t_object x_obj; - t_float *x_vec; + iemarray_t*x_vec; t_symbol *x_arrayname; } t_spec2_tabreceive_tilde; @@ -27,7 +27,7 @@ static t_int *spec2_tabreceive_tilde_perform(t_int *w) t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)(w[1]); t_float *out = (t_float *)(w[2]); int n = w[3]+1; - t_float *vec = x->x_vec; + iemarray_t *vec = x->x_vec; if(vec) while(n--) @@ -43,7 +43,7 @@ static t_int *spec2_tabreceive_tilde_perf16(t_int *w) t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)(w[1]); t_float *out = (t_float *)(w[2]); int n = w[3]; - t_float *vec = x->x_vec; + iemarray_t *vec = x->x_vec; if(vec) { @@ -112,7 +112,7 @@ static void spec2_tabreceive_tilde_dsp(t_spec2_tabreceive_tilde *x, t_signal **s if(*x->x_arrayname->s_name) error("spec2_tabreceive~: %s: no such array", x->x_arrayname->s_name); } - else if(!garray_getfloatarray(a, &vecsize, &x->x_vec)) + else if(!iemarray_getarray(a, &vecsize, &x->x_vec)) error("%s: bad template for spec2_tabreceive~", x->x_arrayname->s_name); else { -- cgit v1.2.1