absl::RemoveCrc32cSuffix

Compute the CRC32C value of a buffer with a suffix removed.

Synopsis

Declared in <absl/crc/crc32c.h>

crc32c_t
RemoveCrc32cSuffix(
    crc32c_t full_string_crc,
    crc32c_t suffix_crc,
    size_t suffix_length);

Description

Calculates the CRC32C value of an existing buffer with a series of bytes (the suffix) removed from the end of that buffer.

Given a CRC32C value of an existing buffer full_string_crc, the CRC32C value of the suffix to remove suffix_crc, and the length of that suffix suffix_len, returns the CRC32C value of the buffer with suffix removed.

This operation has a runtime cost of O(log(suffix_len))

Return Value

The CRC32C value of the buffer with the suffix removed.

Parameters

NameDescription
full_string_crcThe CRC32C value of the complete buffer.
suffix_crcThe CRC32C value of the suffix being removed.
suffix_lengthThe length of the suffix being removed.