mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
cleanup
This commit is contained in:
parent
3a21fdc304
commit
fe8815f80f
1 changed files with 5 additions and 6 deletions
|
@ -40,13 +40,12 @@ namespace ZeroTier {
|
||||||
* A circular buffer
|
* A circular buffer
|
||||||
*
|
*
|
||||||
* For fast handling of continuously-evolving variables (such as path quality metrics).
|
* 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.
|
* metrics without the need for potentially expensive calls to memcpy/memmove.
|
||||||
*
|
*
|
||||||
* Some basic statistical functionality is implemented here in an attempt
|
* Some basic statistical functionality is implemented here in an attempt
|
||||||
* to reduce the complexity of code needed to interact with this type of buffer.
|
* to reduce the complexity of code needed to interact with this type of buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class T,size_t S>
|
template <class T,size_t S>
|
||||||
class RingBuffer
|
class RingBuffer
|
||||||
{
|
{
|
||||||
|
@ -73,7 +72,7 @@ public:
|
||||||
return buf + begin;
|
return buf + begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust buffer index pointer as if we copied data in
|
* Adjust buffer index pointer as if we copied data in
|
||||||
* @param n Number of elements to copy in
|
* @param n Number of elements to copy in
|
||||||
* @return Number of elements we copied in
|
* @return Number of elements we copied in
|
||||||
|
@ -96,13 +95,13 @@ public:
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fast erase, O(1).
|
* Fast erase, O(1).
|
||||||
* Merely reset the buffer pointer, doesn't erase contents
|
* Merely reset the buffer pointer, doesn't erase contents
|
||||||
*/
|
*/
|
||||||
inline void reset() { consume(count()); }
|
inline void reset() { consume(count()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adjust buffer index pointer as if we copied data out
|
* adjust buffer index pointer as if we copied data out
|
||||||
* @param n Number of elements we copied from the buffer
|
* @param n Number of elements we copied from the buffer
|
||||||
* @return Number of elements actually available from the buffer
|
* @return Number of elements actually available from the buffer
|
||||||
|
|
Loading…
Add table
Reference in a new issue