Skip to content

Commit

Permalink
feat: bump snappy to 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed May 30, 2024
1 parent 334d304 commit 557db85
Show file tree
Hide file tree
Showing 6 changed files with 363 additions and 60 deletions.
2 changes: 1 addition & 1 deletion deps/snappy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cmake_minimum_required(VERSION 3.1)
project(Snappy VERSION 1.1.10 LANGUAGES C CXX)
project(Snappy VERSION 1.2.1 LANGUAGES C CXX)

# C++ standard can be overridden when this is used as a sub-project.
if(NOT CMAKE_CXX_STANDARD)
Expand Down
25 changes: 25 additions & 0 deletions deps/snappy/snappy-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,31 @@ static inline std::pair<size_t, bool> FindMatchLength(const char* s1,
}
#endif

static inline size_t FindMatchLengthPlain(const char* s1, const char* s2,
const char* s2_limit) {
// Implementation based on the x86-64 version, above.
assert(s2_limit >= s2);
int matched = 0;

while (s2 <= s2_limit - 8 &&
UNALIGNED_LOAD64(s2) == UNALIGNED_LOAD64(s1 + matched)) {
s2 += 8;
matched += 8;
}
if (LittleEndian::IsLittleEndian() && s2 <= s2_limit - 8) {
uint64_t x = UNALIGNED_LOAD64(s2) ^ UNALIGNED_LOAD64(s1 + matched);
int matching_bits = Bits::FindLSBSetNonZero64(x);
matched += matching_bits >> 3;
s2 += matching_bits >> 3;
} else {
while ((s2 < s2_limit) && (s1[matched] == *s2)) {
++s2;
++matched;
}
}
return matched;
}

// Lookup tables for decompression code. Give --snappy_dump_decompression_table
// to the unit test to recompute char_table.

Expand Down
Loading

0 comments on commit 557db85

Please sign in to comment.