31 #ifndef THIRD_PARTY_SNAPPY_SNAPPY_INTERNAL_H_ 32 #define THIRD_PARTY_SNAPPY_SNAPPY_INTERNAL_H_ 34 #include "snappy-stubs-internal.h" 47 uint16* GetHashTable(
size_t input_size,
int* table_size);
50 uint16 small_table_[1<<10];
67 char* CompressFragment(
const char* input,
71 const int table_size);
85 static inline int FindMatchLength(
const char* s1,
87 const char* s2_limit) {
88 assert(s2_limit >= s2);
95 while (PREDICT_TRUE(s2 <= s2_limit - 8)) {
96 if (UNALIGNED_LOAD64(s2) == UNALIGNED_LOAD64(s1 + matched)) {
104 uint64 x = UNALIGNED_LOAD64(s2) ^ UNALIGNED_LOAD64(s1 + matched);
105 int matching_bits = Bits::FindLSBSetNonZero64(x);
106 matched += matching_bits >> 3;
110 while (PREDICT_TRUE(s2 < s2_limit)) {
111 if (s1[matched] == *s2) {
121 static inline int FindMatchLength(
const char* s1,
123 const char* s2_limit) {
125 assert(s2_limit >= s2);
128 while (s2 <= s2_limit - 4 &&
129 UNALIGNED_LOAD32(s2) == UNALIGNED_LOAD32(s1 + matched)) {
133 if (LittleEndian::IsLittleEndian() && s2 <= s2_limit - 4) {
134 uint32 x = UNALIGNED_LOAD32(s2) ^ UNALIGNED_LOAD32(s1 + matched);
135 int matching_bits = Bits::FindLSBSetNonZero(x);
136 matched += matching_bits >> 3;
138 while ((s2 < s2_limit) && (s1[matched] == *s2)) {
150 #endif // THIRD_PARTY_SNAPPY_SNAPPY_INTERNAL_H_