diff --git a/common/circular_buffer.h b/common/circular_buffer.h index 0d456e323..a5b35be31 100644 --- a/common/circular_buffer.h +++ b/common/circular_buffer.h @@ -14,13 +14,13 @@ class CircularBuffer { T& next() { return data_[first_.get() % SIZE]; } size_t size() const { return first_.get() - last_.get(); } - bool empty() const { size() == 0; } + bool empty() const { return size() == 0; } size_t space_available() const { return SIZE - size(); } size_t continuous_space() const { - return std::min(space_available(), SIZE - last_.get() % SIZE); + return std::min(space_available(), SIZE - first_.get() % SIZE); } size_t continuous_data() const { - return std::min(size(), SIZE - first_.get() % SIZE); + return std::min(size(), SIZE - last_.get() % SIZE); } void push() { first_ += 1; }