Files
scylladb/utils/gz/crc_combine.hh
Kefu Chai 7215d4bfe9 utils: do not include unused headers
these unused includes were identifier by clang-include-cleaner. after
auditing these source files, all of the reports have been confirmed.

please note, because quite a few source files relied on
`utils/to_string.hh` to pull in the specialization of
`fmt::formatter<std::optional<T>>`, after removing
`#include <fmt/std.h>` from `utils/to_string.hh`, we have to
include `fmt/std.h` directly.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2025-01-14 07:56:39 -05:00

32 lines
714 B
C++

/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*
*/
#pragma once
#include <cstdint>
#include <sys/types.h>
/*
* Computes CRC32 (gzip format, RFC 1952) of a compound bitstream M composed by
* concatenating bitstream A (first) and bitstream B (second), where:
*
* - crc is the CRC32 of bitstream A
* - crc2 is the CRC32 of bitstream B
* - len2 is length of bitstream B in bytes
*/
uint32_t fast_crc32_combine(uint32_t crc, uint32_t crc2, ssize_t len2);
static constexpr bool fast_crc32_combine_optimized() {
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
return true;
#else
return false;
#endif
}