47 std::uint32_t buffer_pos,
48 const std::size_t& buffer_size)
50 auto bytes_to_copy =
size;
51 while (bytes_to_copy > 0) {
52 auto n = std::min(bytes_to_copy, buffer_size - buffer_pos);
53 std::memcpy(
static_cast<char*
>(buffer) + buffer_pos, data, n);
56 if (buffer_pos == buffer_size) {