Commit 67958f7f authored by Max Kellermann's avatar Max Kellermann

util/{Static,Foreign}FifoBuffer: lazy shift

Reduce the number of unnecessary memmove() calls.
parent ab9c5272
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment