absl::ExtendCrc32cByZeroes

Extend a CRC32C value as if trailing zero bytes were appended.

Synopsis

Declared in <absl/crc/crc32c.h>

crc32c_t
ExtendCrc32cByZeroes(
    crc32c_t initial_crc,
    size_t length);

Description

Computes a CRC32C value for a buffer with an initial_crc CRC32C value, where length bytes with a value of 0 are appended to the buffer. Using this function is more efficient than computing a CRC32C value for the combined buffer from scratch.

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

Return Value

The CRC32C value of the extended buffer.

Parameters

NameDescription
initial_crcThe CRC32C value of the existing buffer.
lengthThe number of zero bytes appended.