| 699 | |
| 700 | template <bool len_less_than_12> |
| 701 | static inline char* EmitCopy(char* op, size_t offset, size_t len) { |
| 702 | assert(len_less_than_12 == (len < 12)); |
| 703 | if (len_less_than_12) { |
| 704 | return EmitCopyAtMost64</*len_less_than_12=*/true>(op, offset, len); |
| 705 | } else { |
| 706 | // A special case for len <= 64 might help, but so far measurements suggest |
| 707 | // it's in the noise. |
| 708 | |
| 709 | // Emit 64 byte copies but make sure to keep at least four bytes reserved. |
| 710 | while (SNAPPY_PREDICT_FALSE(len >= 68)) { |
| 711 | op = EmitCopyAtMost64</*len_less_than_12=*/false>(op, offset, 64); |
| 712 | len -= 64; |
| 713 | } |
| 714 | |
| 715 | // One or two copies will now finish the job. |
| 716 | if (len > 64) { |
| 717 | op = EmitCopyAtMost64</*len_less_than_12=*/false>(op, offset, 60); |
| 718 | len -= 60; |
| 719 | } |
| 720 | |
| 721 | // Emit remainder. |
| 722 | if (len < 12) { |
| 723 | op = EmitCopyAtMost64</*len_less_than_12=*/true>(op, offset, len); |
| 724 | } else { |
| 725 | op = EmitCopyAtMost64</*len_less_than_12=*/false>(op, offset, len); |
| 726 | } |
| 727 | return op; |
| 728 | } |
| 729 | } |
| 730 | |
| 731 | bool GetUncompressedLength(const char* start, size_t n, size_t* result) { |
| 732 | uint32_t v = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected