util/{Static,Foreign}FifoBuffer: lazy shift
Reduce the number of unnecessary memmove() calls.
This commit is contained in:
parent
ab9c527274
commit
67958f7fa7
@ -147,7 +147,11 @@ public:
|
||||
* When you are finished, call append().
|
||||
*/
|
||||
Range Write() {
|
||||
Shift();
|
||||
if (IsEmpty())
|
||||
Clear();
|
||||
else if (tail == capacity)
|
||||
Shift();
|
||||
|
||||
return Range(data + tail, capacity - tail);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,11 @@ public:
|
||||
* When you are finished, call append().
|
||||
*/
|
||||
Range Write() {
|
||||
Shift();
|
||||
if (IsEmpty())
|
||||
Clear();
|
||||
else if (tail == size)
|
||||
Shift();
|
||||
|
||||
return Range(data + tail, size - tail);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user