in reply to Re: Circular buffer instead of shift/push
in thread Circular buffer instead of shift/push
since $tl ("tail") is left pointing at the last item written.@all = @a < $sz ? @a : @a[ $tl+1 .. $top, 0 .. $tl ];
test in the canonical loop. Modulo would seem to be in the sameshift @a if @a == $sz;
Oddly, the direct retrieval seems to take about as long as retrieving
through the index array(!?!), but it certainly is clearer,
thanks again,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Circular buffer instead of shift/push
by fundflow (Chaplain) on Jan 12, 2001 at 08:42 UTC | |
by petral (Curate) on Jan 12, 2001 at 08:54 UTC | |
by petral (Curate) on Jan 13, 2001 at 07:40 UTC | |
by repson (Chaplain) on Jan 13, 2001 at 13:14 UTC | |
by petral (Curate) on Jan 16, 2001 at 08:24 UTC | |
by fundflow (Chaplain) on Jan 14, 2001 at 04:57 UTC | |
by petral (Curate) on Jan 16, 2001 at 08:17 UTC | |
by petral (Curate) on Jan 16, 2001 at 09:24 UTC | |
by petral (Curate) on Jan 16, 2001 at 14:20 UTC |