We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b7edc11 commit 9a14dd6Copy full SHA for 9a14dd6
api/RingBuffer.h
@@ -53,6 +53,7 @@ class RingBufferN
53
54
private:
55
int nextIndex(int index);
56
+ inline bool isEmpty() const { return (_numElems == 0); }
57
};
58
59
typedef RingBufferN<SERIAL_BUFFER_SIZE> RingBuffer;
@@ -91,7 +92,7 @@ void RingBufferN<N>::clear()
91
92
template <int N>
93
int RingBufferN<N>::read_char()
94
{
- if(_iTail == _iHead)
95
+ if (isEmpty())
96
return -1;
97
98
uint8_t value = _aucBuffer[_iTail];
@@ -116,7 +117,7 @@ int RingBufferN<N>::availableForStore()
116
117
118
int RingBufferN<N>::peek()
119
120
121
122
123
return _aucBuffer[_iTail];
0 commit comments