Files
scylladb/utils/gz/crc_combine.hh
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

33 lines
709 B
C++

/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*
*/
#pragma once
#include <cstdint>
#include <sys/types.h>
#include <memory>
/*
* 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
}