0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::buffer: Minor cleanup; operator stack reuse.

This commit is contained in:
Jason Volk 2020-08-29 16:47:50 -07:00
parent 19b9113222
commit 55c3c54aef

View file

@ -272,7 +272,11 @@ __attribute__((always_inline))
ircd::buffer::reverse(const mutable_buffer &dst,
const const_buffer &src)
{
const size_t ret{std::min(size(dst), size(src))};
const size_t ret
{
std::min(size(dst), size(src))
};
std::reverse_copy(data(src), data(src) + ret, data(dst));
return ret;
}
@ -283,7 +287,11 @@ __attribute__((always_inline))
ircd::buffer::operator+=(buffer<it> &buffer,
const size_t &bytes)
{
const size_t &advance(std::min(bytes, size(buffer)));
const size_t &advance
{
std::min(bytes, size(buffer))
};
consume(buffer, advance);
return buffer;
}
@ -329,8 +337,9 @@ __attribute__((always_inline))
ircd::buffer::operator+(const buffer<it> &buffer,
const size_t &bytes)
{
const size_t advance{std::min(bytes, size(buffer))};
return { begin(buffer) + advance, size(buffer) - advance };
auto ret(buffer);
ret += bytes;
return ret;
}
template<class it>