|
@@ -40,13 +40,12 @@ namespace ZeroTier {
|
|
|
* A circular buffer
|
|
|
*
|
|
|
* For fast handling of continuously-evolving variables (such as path quality metrics).
|
|
|
- * Using this, we can maintain longer sliding historical windows for important path
|
|
|
+ * Using this, we can maintain longer sliding historical windows for important path
|
|
|
* metrics without the need for potentially expensive calls to memcpy/memmove.
|
|
|
*
|
|
|
* Some basic statistical functionality is implemented here in an attempt
|
|
|
* to reduce the complexity of code needed to interact with this type of buffer.
|
|
|
*/
|
|
|
-
|
|
|
template <class T,size_t S>
|
|
|
class RingBuffer
|
|
|
{
|
|
@@ -73,7 +72,7 @@ public:
|
|
|
return buf + begin;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* Adjust buffer index pointer as if we copied data in
|
|
|
* @param n Number of elements to copy in
|
|
|
* @return Number of elements we copied in
|
|
@@ -96,13 +95,13 @@ public:
|
|
|
return n;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Fast erase, O(1).
|
|
|
+ /**
|
|
|
+ * Fast erase, O(1).
|
|
|
* Merely reset the buffer pointer, doesn't erase contents
|
|
|
*/
|
|
|
inline void reset() { consume(count()); }
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* adjust buffer index pointer as if we copied data out
|
|
|
* @param n Number of elements we copied from the buffer
|
|
|
* @return Number of elements actually available from the buffer
|