Updated ringbuffer sink

This commit is contained in:
gabime
2019-11-10 00:08:50 +02:00
parent cff6644b28
commit 0cb38085a1
4 changed files with 65 additions and 44 deletions

View File

@@ -77,11 +77,11 @@ public:
{
if (tail_ >= head_)
{
return tail_ - head_;
return tail_ - head_;
}
else
{
return max_items_ - (head_ - tail_ );
return max_items_ - (head_ - tail_);
}
}
@@ -90,7 +90,7 @@ public:
const T &at(size_t i) const
{
assert(i < size());
return v_[(head_+ i) % max_items_];
return v_[(head_ + i) % max_items_];
}
// Pop item from front.