diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2005-05-30 16:55:33 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 13:53:22 +0200 |
commit | 7fc71ea46f7424a15cf39d0be2b9525fa6d5a1f0 (patch) | |
tree | 2a5ccff99beebaabe509a8360e0919c38a12ed0b /src | |
parent | b482058421cce60ced22afcbba3354052e417c7c (diff) |
bugfix of the lifo objects.
svn path=/trunk/externals/maxlib/; revision=3097
Diffstat (limited to 'src')
-rw-r--r-- | src/lifo.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -33,7 +33,7 @@ typedef struct lifo {
t_object d_ob;
t_float *getal;
- t_int count, end, size, teller;
+ t_int size, teller;
t_outlet *out;
}t_lifo;
@@ -41,19 +41,23 @@ typedef struct lifo static t_class *lifo_class;
static void lifo_int(t_lifo *x, t_floatarg n)
-{
- x->getal[x->count] = n;
- x->end = x->count;
- if (x->teller < x->size) x->teller++;
- x->count = (x->count + 1) % x->size;
+{ + if(x->teller < x->size ) + { + x->getal[x->teller] = n;
+ x->teller++; + } + else + post("no more lifo memory"); +
}
static void lifo_bang(t_lifo *x)
{
- if (x->teller > 0){
- outlet_float(x->out,x->getal[x->end]);
+ if (x->teller > 0) + {
+ outlet_float(x->out,x->getal[x->teller-1]);
x->teller--;
- x->end = (x->end + x->size - 1) % x->size;
}
}
@@ -74,8 +78,6 @@ static void *lifo_new(t_floatarg n) if (n<10) n = 10;
x->size = (t_int)n;
x->teller = 0;
- x->end = 0;
- x->count = 0;
x->getal = (t_float *)getbytes(x->size * sizeof(t_float));
x->out = outlet_new(&x->d_ob, gensym("float"));
|