aboutsummaryrefslogtreecommitdiff
path: root/src/tabminmax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabminmax.c')
-rw-r--r--src/tabminmax.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tabminmax.c b/src/tabminmax.c
index 3e5dbf7..a7e622d 100644
--- a/src/tabminmax.c
+++ b/src/tabminmax.c
@@ -54,28 +54,28 @@ static void tabminmax_bang(t_tabminmax *x)
if(stop<start||stop>npoints)stop=npoints;
npoints=stop-start;
- min=vec[start];
- max=vec[start];
+ min=zarray_getfloat(vec, start);
+ max=min;
mindex=start;
maxdex=start;
for (n = 1; n < npoints; n++){
- t_float val=vec[start+n];
- if(val<min){
- mindex=start+n;
- min=val;
- }
- if(val>max){
- maxdex=start+n;
- max=val;
- }
+ t_float val=zarray_getfloat(vec, start+n);
+ if(val<min){
+ mindex=start+n;
+ min=val;
+ }
+ if(val>max){
+ maxdex=start+n;
+ max=val;
+ }
}
-
+
SETFLOAT(atombuf, max);
SETFLOAT(atombuf+1, maxdex);
outlet_list(x->max_out, &s_list, 2, atombuf);
-
+
SETFLOAT(atombuf, min);
SETFLOAT(atombuf+1, mindex);
outlet_list(x->min_out, &s_list, 2, atombuf);