Use memcpy to avoid putting one byte at a time when copying blocks

`memcpy` is likely to be faster than the naive method due to the
possibility of use of vector instructions and copying more than a byte
at a time.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-09-09 03:14:39 +02:00
committed by AeroStun
parent f0d7b5393c
commit d41b7c2328

View File

@@ -1298,9 +1298,8 @@ copy_block(
put_short((std::uint16_t)len);
put_short((std::uint16_t)~len);
}
// VFALCO Use memcpy?
while (len--)
put_byte(*buf++);
std::memcpy(&pending_buf_[pending_], buf, len);
pending_ += len;
}
//------------------------------------------------------------------------------