9#ifndef BROTLI_ENC_FIND_MATCH_LENGTH_H_
10#define BROTLI_ENC_FIND_MATCH_LENGTH_H_
12#include <brotli/types.h>
16#if defined(__cplusplus) || defined(c_plusplus)
21#if defined(BROTLI_TZCNT64) && BROTLI_64_BITS && BROTLI_LITTLE_ENDIAN
25 const uint8_t *s1_orig =
s1;
27 uint64_t x = BROTLI_UNALIGNED_LOAD64LE(s2) ^
28 BROTLI_UNALIGNED_LOAD64LE(
s1);
31 size_t matching_bits = (size_t)BROTLI_TZCNT64(x);
32 return (
size_t)(
s1 - s1_orig) + (matching_bits >> 3);
41 return (
size_t)(
s1 - s1_orig);
48 const uint8_t* s2_limit = s2 +
limit;
49 const uint8_t* s2_ptr = s2;
54 while (s2_ptr <= s2_limit - 4 &&
55 BrotliUnalignedRead32(s2_ptr) ==
56 BrotliUnalignedRead32(
s1 + matched)) {
60 while ((s2_ptr < s2_limit) && (
s1[matched] == *s2_ptr)) {
68#if defined(__cplusplus) || defined(c_plusplus)
#define s1(x)
Definition Sha256.c:142
static uint32_t const uint8_t uint32_t uint32_t limit
Definition memcmplen.h:45