| 603 | /// the buffer here directly and force inlining. |
| 604 | #[inline(always)] |
| 605 | fn push_bytes_to_mutable_buffer(value_buffer: &mut MutableBuffer, bytes: &[u8]) { |
| 606 | let n = bytes.len(); |
| 607 | let old_len = value_buffer.len(); |
| 608 | value_buffer.reserve(n); |
| 609 | |
| 610 | // SAFETY: we reserved `n` bytes; the source and destination do not alias |
| 611 | // because `bytes` was passed in by the caller and `value_buffer` is owned. |
| 612 | unsafe { |
| 613 | let dst = value_buffer.as_mut_ptr().add(old_len); |
| 614 | let src = bytes.as_ptr(); |
| 615 | match n { |
| 616 | 0 => {} |
| 617 | 1 => std::ptr::copy_nonoverlapping(src, dst, 1), |
| 618 | 2 => std::ptr::copy_nonoverlapping(src, dst, 2), |
| 619 | 3 => std::ptr::copy_nonoverlapping(src, dst, 3), |
| 620 | 4 => std::ptr::copy_nonoverlapping(src, dst, 4), |
| 621 | 5 => std::ptr::copy_nonoverlapping(src, dst, 5), |
| 622 | 6 => std::ptr::copy_nonoverlapping(src, dst, 6), |
| 623 | 7 => std::ptr::copy_nonoverlapping(src, dst, 7), |
| 624 | 8 => std::ptr::copy_nonoverlapping(src, dst, 8), |
| 625 | _ => std::ptr::copy_nonoverlapping(src, dst, n), |
| 626 | } |
| 627 | value_buffer.set_len(old_len + n); |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | #[inline(always)] |
| 632 | fn push_char_to_mutable_buffer(value_buffer: &mut MutableBuffer, c: char) { |