mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
static_buffer::consume improvement
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
Version 84:
|
Version 84:
|
||||||
|
|
||||||
* Tidy up buffer_front
|
* Tidy up buffer_front
|
||||||
|
* static_buffer::consume improvement
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -260,9 +260,19 @@ void
|
|||||||
static_buffer_base::
|
static_buffer_base::
|
||||||
consume(std::size_t size)
|
consume(std::size_t size)
|
||||||
{
|
{
|
||||||
size = (std::min)(size, in_size_);
|
if(size < in_size_)
|
||||||
in_off_ = (in_off_ + size) % capacity_;
|
{
|
||||||
in_size_ -= size;
|
in_off_ = (in_off_ + size) % capacity_;
|
||||||
|
in_size_ -= size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// rewind the offset, so the next call to prepare
|
||||||
|
// can have a longer continguous segment. this helps
|
||||||
|
// algorithms optimized for larger buffesr.
|
||||||
|
in_off_ = 0;
|
||||||
|
in_size_ = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
Reference in New Issue
Block a user