kopia lustrzana https://github.com/xdsopl/robot36
oops, off by one error in circular buffer
rodzic
25adda3d8c
commit
cb5abfecd0
4
buffer.c
4
buffer.c
|
@ -12,8 +12,8 @@ float *do_buffer(struct buffer *d, float input)
|
|||
{
|
||||
d->s[d->last0] = input;
|
||||
d->s[d->last1] = input;
|
||||
d->last0 = (d->last0 - 1) < 0 ? d->len : d->last0 - 1;
|
||||
d->last1 = (d->last1 - 1) < 0 ? d->len : d->last1 - 1;
|
||||
d->last0 = (d->last0 - 1) < 0 ? d->len - 1 : d->last0 - 1;
|
||||
d->last1 = (d->last1 - 1) < 0 ? d->len - 1 : d->last1 - 1;
|
||||
int last = d->last0 < d->last1 ? d->last0 : d->last1;
|
||||
return d->s + last;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue